linux-stable/drivers/char
Zhang Yuchen 9c476590fe ipmi: fix long wait in unload when IPMI disconnect
commit f6f1234d98 upstream.

When fixing the problem mentioned in PATCH1, we also found
the following problem:

If the IPMI is disconnected and in the sending process, the
uninstallation driver will be stuck for a long time.

The main problem is that uninstalling the driver waits for curr_msg to
be sent or HOSED. After stopping tasklet, the only place to trigger the
timeout mechanism is the circular poll in shutdown_smi.

The poll function delays 10us and calls smi_event_handler(smi_info,10).
Smi_event_handler deducts 10us from kcs->ibf_timeout.

But the poll func is followed by schedule_timeout_uninterruptible(1).
The time consumed here is not counted in kcs->ibf_timeout.

So when 10us is deducted from kcs->ibf_timeout, at least 1 jiffies has
actually passed. The waiting time has increased by more than a
hundredfold.

Now instead of calling poll(). call smi_event_handler() directly and
calculate the elapsed time.

For verification, you can directly use ebpf to check the kcs->
ibf_timeout for each call to kcs_event() when IPMI is disconnected.
Decrement at normal rate before unloading. The decrement rate becomes
very slow after unloading.

  $ bpftrace -e 'kprobe:kcs_event {printf("kcs->ibftimeout : %d\n",
      *(arg0+584));}'

Signed-off-by: Zhang Yuchen <zhangyuchen.lcr@bytedance.com>
Message-Id: <20221007092617.87597-3-zhangyuchen.lcr@bytedance.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-01-07 11:11:52 +01:00
..
agp IOMMU Updates for Linux v5.20/v6.0: 2022-08-06 10:42:38 -07:00
hw_random hwrng: geode - Fix PCI device refcount leak 2022-12-31 13:32:37 +01:00
ipmi ipmi: fix long wait in unload when IPMI disconnect 2023-01-07 11:11:52 +01:00
mwave
pcmcia tty: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
tpm tpm: tpm_tis: Add the missed acpi_put_table() to fix memory leak 2023-01-04 11:29:02 +01:00
xilinx_hwicap
xillybus char: xillybus: fix a refcount leak in cleanup_dev() 2022-04-24 17:30:45 +02:00
adi.c
apm-emulation.c apm-emulation: drop unexpected word "the" in the comments 2022-06-27 16:15:27 +02:00
applicom.c
applicom.h
bsr.c
ds1620.c
dsp56k.c
dtlk.c
hangcheck-timer.c
hpet.c
Kconfig Char / Misc driver changes for 6.0-rc1 2022-08-04 11:05:48 -07:00
lp.c char: lp: remove redundant initialization of err 2022-06-10 15:29:50 +02:00
Makefile char: remove VR41XX related char driver 2022-07-28 16:12:33 +02:00
mem.c random: restore O_NONBLOCK support 2022-09-23 12:27:57 +02:00
misc.c char: misc: remove usage of list iterator past the loop body 2022-04-24 17:15:12 +02:00
mspec.c
nsc_gpio.c
nvram.c
nwbutton.c
nwbutton.h
nwflash.c
pc8736x_gpio.c
powernv-op-panel.c
ppdev.c
ps3flash.c
random.c random: add helpers for random numbers with given floor or range 2023-01-07 11:11:40 +01:00
scx200_gpio.c
sonypi.c
tlclk.c
toshiba.c
ttyprintk.c char: ttyprintk: register console 2022-04-22 16:24:47 +02:00
uv_mmtimer.c
virtio_console.c Char/Misc and other driver updates for 5.18-rc1 2022-03-28 12:27:35 -07:00