linux/drivers/char
Kamlakant Patel c4436c9149 ipmi_ssif: avoid registering duplicate ssif interface
It is possible that SSIF interface entry is present in both DMI and ACPI
tables. In SMP systems, in such cases it is possible that ssif_probe could
be called simultaneously from i2c interface (from ACPI) and from DMI on
different CPUs at kernel boot. Both try to register same SSIF interface
simultaneously and result in race.

In such cases where ACPI and SMBIOS both IPMI entries are available, we
need to prefer ACPI over SMBIOS so that ACPI functions work properly if
they use IPMI.
So, if we get an ACPI interface and have already registered an SMBIOS
at the same address, we need to remove the SMBIOS one and add the ACPI.

Log:
[   38.774743] ipmi device interface
[   38.805006] ipmi_ssif: IPMI SSIF Interface driver
[   38.861979] ipmi_ssif i2c-IPI0001:06: ssif_probe CPU 99 ***
[   38.863655] ipmi_ssif 0-000e: ssif_probe CPU 14 ***
[   38.863658] ipmi_ssif: Trying SMBIOS-specified SSIF interface at i2c address 0xe, adapter xlp9xx-i2c, slave address 0x0
[   38.869500] ipmi_ssif: Trying ACPI-specified SSIF interface at i2c address 0xe, adapter xlp9xx-i2c, slave address 0x0
[   38.914530] ipmi_ssif: Unable to clear message flags: -22 7 c7
[   38.952429] ipmi_ssif: Unable to clear message flags: -22 7 00
[   38.994734] ipmi_ssif: Error getting global enables: -22 7 00
[   39.015877] ipmi_ssif 0-000e: IPMI message handler: Found new BMC (man_id: 0x00b3d1, prod_id: 0x0001, dev_id: 0x20)
[   39.377645] ipmi_ssif i2c-IPI0001:06: IPMI message handler: Found new BMC (man_id: 0x00b3d1, prod_id: 0x0001, dev_id: 0x20)
[   39.387863] ipmi_ssif 0-000e: IPMI message handler: BMC returned incorrect response, expected netfn 7 cmd 42, got netfn 7 cmd 1
...
[NOTE] : Added custom prints to explain the problem.

In the above log, ssif_probe is executed simultaneously on two different
CPUs.

This patch fixes this issue in following way:
 - Adds ACPI entry also to the 'ssif_infos' list.
 - Checks the list if SMBIOS is already registered, removes it and adds
   ACPI.
 - If ACPI is already registered, it ignores SMBIOS.
 - Adds mutex lock throughout the probe process to avoid race.

Signed-off-by: Kamlakant Patel <kamlakantp@marvell.com>
Message-Id: <1566389064-27356-1-git-send-email-kamlakantp@marvell.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2019-08-22 11:06:33 -05:00
..
agp Merge branch 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2019-07-08 10:39:56 -07:00
hw_random docs: admin-guide: add a series of orphaned documents 2019-07-15 11:03:02 -03:00
ipmi ipmi_ssif: avoid registering duplicate ssif interface 2019-08-22 11:06:33 -05:00
mwave treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
pcmcia treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 18 2019-05-21 11:28:46 +02:00
tpm tpm: Don't duplicate events from the final event log in the TCG2 log 2019-06-24 23:57:50 +03:00
xilinx_hwicap treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
xillybus treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 402 2019-06-05 17:37:13 +02:00
adi.c char: sparc64: Add privileged ADI driver 2018-06-05 11:24:55 -07:00
apm-emulation.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
applicom.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
applicom.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bsr.c Merge 5.2-rc4 into char-misc-next 2019-06-09 09:11:21 +02:00
ds1620.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
dsp56k.c vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
dtlk.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
efirtc.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
hangcheck-timer.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 405 2019-06-05 17:37:13 +02:00
hpet.c hpet: Fix division by zero in hpet_time_div() 2019-07-25 14:39:51 +02:00
Kconfig docs: admin-guide: add a series of orphaned documents 2019-07-15 11:03:02 -03:00
lp.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
Makefile char/generic_nvram: Remove as unused 2019-01-22 10:21:45 +01:00
mbcs.c mbcs: add .owner to mbcs struct file_operations 2019-01-22 14:56:00 +01:00
mbcs.h
mem.c Remove 'type' argument from access_ok() function 2019-01-03 18:57:57 -08:00
misc.c char: misc: Move EXPORT_SYMBOL immediately next to the functions/varibles 2019-05-24 18:00:41 +02:00
mspec.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206 2019-05-30 11:29:53 -07:00
nsc_gpio.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
nvram.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
nwbutton.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
nwbutton.h treewide: Switch DEFINE_TIMER callbacks to struct timer_list * 2017-11-21 15:57:05 -08:00
nwflash.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
pc8736x_gpio.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
powernv-op-panel.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
ppdev.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
ps3flash.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 164 2019-05-30 11:26:38 -07:00
random.c random: fix soft lockup when trying to read from an uninitialized blocking pool 2019-05-26 00:11:49 -04:00
raw.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
rtc.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
scx200_gpio.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
snsc_event.c sched/headers: Prepare for new header dependencies before moving code to <linux/sched/signal.h> 2017-03-02 08:42:29 +01:00
snsc.c vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
snsc.h
sonypi.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61 2019-05-24 17:36:45 +02:00
tb0219.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
tlclk.c tlclk: clean an indentation issue, remove extraneous tabs 2018-11-11 12:58:27 -08:00
toshiba.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 129 2019-05-30 11:25:14 -07:00
ttyprintk.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 402 2019-06-05 17:37:13 +02:00
uv_mmtimer.c
virtio_console.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00