linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] ipmi: various collected bug fixes
@ 2014-10-06 19:17 minyard
  2014-10-06 19:17 ` [PATCH 1/4] ipmi: Clean up the error handling for channel config errors minyard
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: minyard @ 2014-10-06 19:17 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Linux Kernel, OpenIPMI Developers

These have been in linux-next for a while, ready for 3.18.

Thanks,

-corey


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/4] ipmi: Clean up the error handling for channel config errors
  2014-10-06 19:17 [PATCH 0/4] ipmi: various collected bug fixes minyard
@ 2014-10-06 19:17 ` minyard
  2014-10-06 19:17 ` [PATCH 2/4] ipmi/of: Don't use unavailable interfaces minyard
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: minyard @ 2014-10-06 19:17 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Linux Kernel, OpenIPMI Developers, Corey Minyard

From: Corey Minyard <cminyard@mvista.com>

The code to send the channel config errors was missing an error report
in one place and needed some more information in another, and had an
extraneous bit of code.  Clean all that up.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
---
 drivers/char/ipmi/ipmi_msghandler.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index e6db938..f816211 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -2796,7 +2796,6 @@ channel_handler(ipmi_smi_t intf, struct ipmi_recv_msg *msg)
 					= IPMI_CHANNEL_MEDIUM_IPMB;
 				intf->channels[0].protocol
 					= IPMI_CHANNEL_PROTOCOL_IPMB;
-				rv = -ENOSYS;
 
 				intf->curr_channel = IPMI_MAX_CHANNELS;
 				wake_up(&intf->waitq);
@@ -2821,12 +2820,12 @@ channel_handler(ipmi_smi_t intf, struct ipmi_recv_msg *msg)
 
 		if (rv) {
 			/* Got an error somehow, just give up. */
+			printk(KERN_WARNING PFX
+			       "Error sending channel information for channel"
+			       " %d: %d\n", intf->curr_channel, rv);
+
 			intf->curr_channel = IPMI_MAX_CHANNELS;
 			wake_up(&intf->waitq);
-
-			printk(KERN_WARNING PFX
-			       "Error sending channel information: %d\n",
-			       rv);
 		}
 	}
  out:
@@ -2964,8 +2963,12 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
 		intf->null_user_handler = channel_handler;
 		intf->curr_channel = 0;
 		rv = send_channel_info_cmd(intf, 0);
-		if (rv)
+		if (rv) {
+			printk(KERN_WARNING PFX
+			       "Error sending channel information for channel"
+			       " 0, %d\n", rv);
 			goto out;
+		}
 
 		/* Wait for the channel info to be read. */
 		wait_event(intf->waitq,
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/4] ipmi/of: Don't use unavailable interfaces
  2014-10-06 19:17 [PATCH 0/4] ipmi: various collected bug fixes minyard
  2014-10-06 19:17 ` [PATCH 1/4] ipmi: Clean up the error handling for channel config errors minyard
@ 2014-10-06 19:17 ` minyard
  2014-10-06 19:17 ` [PATCH 3/4] ipmi: work around gcc-4.9 build warning minyard
  2014-10-06 19:17 ` [PATCH 4/4] ipmi: Clear drvdata when interface is removed minyard
  3 siblings, 0 replies; 5+ messages in thread
From: minyard @ 2014-10-06 19:17 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Linux Kernel, OpenIPMI Developers, Benjamin Herrenschmidt, Corey Minyard

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>

If an IPMI controller is used by the firmware and as such marked with
a reserved status, we shouldn't use it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
---
 drivers/char/ipmi/ipmi_si_intf.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 5d66568..4fc8931 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2658,6 +2658,9 @@ static int ipmi_probe(struct platform_device *dev)
 	if (!match)
 		return -EINVAL;
 
+	if (!of_device_is_available(np))
+		return -EINVAL;
+
 	ret = of_address_to_resource(np, 0, &resource);
 	if (ret) {
 		dev_warn(&dev->dev, PFX "invalid address from OF\n");
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/4] ipmi: work around gcc-4.9 build warning
  2014-10-06 19:17 [PATCH 0/4] ipmi: various collected bug fixes minyard
  2014-10-06 19:17 ` [PATCH 1/4] ipmi: Clean up the error handling for channel config errors minyard
  2014-10-06 19:17 ` [PATCH 2/4] ipmi/of: Don't use unavailable interfaces minyard
@ 2014-10-06 19:17 ` minyard
  2014-10-06 19:17 ` [PATCH 4/4] ipmi: Clear drvdata when interface is removed minyard
  3 siblings, 0 replies; 5+ messages in thread
From: minyard @ 2014-10-06 19:17 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Linux Kernel, OpenIPMI Developers, Arnd Bergmann, Corey Minyard

From: Arnd Bergmann <arnd@arndb.de>

Building ipmi on arm with gcc-4.9 results in this warning
for an allmodconfig build:

drivers/char/ipmi/ipmi_si_intf.c: In function 'ipmi_thread':
include/linux/time.h:28:5: warning: 'busy_until.tv_sec' may be used uninitialized in this function [-Wmaybe-uninitialized]
  if (lhs->tv_sec > rhs->tv_sec)
     ^
drivers/char/ipmi/ipmi_si_intf.c:1007:18: note: 'busy_until.tv_sec' was declared here
  struct timespec busy_until;
                  ^

The warning is bogus and this case can not occur. Apparently
this is a false positive resulting from gcc getting a little
smarter about tracking assignments but not smart enough. Marking
the ipmi_thread_busy_wait function as inline gives the gcc
optimization logic enough information to figure out for itself
that the case cannot happen, which gets rid of the warning
without adding any fake initialization.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
---
 drivers/char/ipmi/ipmi_si_intf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 4fc8931..1c43f9a 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -965,9 +965,9 @@ static inline int ipmi_si_is_busy(struct timespec *ts)
 	return ts->tv_nsec != -1;
 }
 
-static int ipmi_thread_busy_wait(enum si_sm_result smi_result,
-				 const struct smi_info *smi_info,
-				 struct timespec *busy_until)
+static inline int ipmi_thread_busy_wait(enum si_sm_result smi_result,
+					const struct smi_info *smi_info,
+					struct timespec *busy_until)
 {
 	unsigned int max_busy_us = 0;
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 4/4] ipmi: Clear drvdata when interface is removed
  2014-10-06 19:17 [PATCH 0/4] ipmi: various collected bug fixes minyard
                   ` (2 preceding siblings ...)
  2014-10-06 19:17 ` [PATCH 3/4] ipmi: work around gcc-4.9 build warning minyard
@ 2014-10-06 19:17 ` minyard
  3 siblings, 0 replies; 5+ messages in thread
From: minyard @ 2014-10-06 19:17 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Linux Kernel, OpenIPMI Developers, Takao Indoh, Corey Minyard

From: Takao Indoh <indou.takao@jp.fujitsu.com>

This patch fixes a bug on hotmod removing.

After ipmi interface is removed using hotmod, kernel panic occurs when
rmmod impi_si. For example, try this:

 # echo "remove,"`cat /proc/ipmi/0/params` > \
 /sys/module/ipmi_si/parameters/hotmod
 # rmmod ipmi_si

Then, rmmod fails with the following messages.

------------[ cut here ]------------
WARNING: CPU: 12 PID: 10819 at /mnt/repos/linux/lib/list_debug.c:53
__list_del_entry+0x63/0xd0()
(snip)
CPU: 12 PID: 10819 Comm: rmmod Not tainted 3.17.0-rc1 #19
Hardware name: FUJITSU-SV PRIMERGY BX920 S2/D3030, BIOS 080015
Rev.3D81.3030 02/10/2012
 0000000000000009 ffff88022d547d40 ffffffff81575778 ffff88022d547d88
 ffff88022d547d78 ffffffff8104ec5d ffff88023908cdb0 ffffffffa06fa4e0
 ffff8800bac20860 0000000000000000 0000000002046090 ffff88022d547dd8
Call Trace:
 [<ffffffff81575778>] dump_stack+0x45/0x56
 [<ffffffff8104ec5d>] warn_slowpath_common+0x7d/0xa0
 [<ffffffff8104eccc>] warn_slowpath_fmt+0x4c/0x50
 [<ffffffff811f60bf>] ? __kernfs_remove+0xdf/0x220
 [<ffffffff81291213>] __list_del_entry+0x63/0xd0
 [<ffffffff8129128d>] list_del+0xd/0x30
 [<ffffffffa06f285a>] cleanup_one_si+0x2a/0x230 [ipmi_si]
 [<ffffffffa06f2f05>] ipmi_pnp_remove+0x15/0x20 [ipmi_si]
 [<ffffffff8131c7d4>] pnp_device_remove+0x24/0x40
 [<ffffffff8137175f>] __device_release_driver+0x7f/0xf0
 [<ffffffff81372100>] driver_detach+0xb0/0xc0
 [<ffffffff81371415>] bus_remove_driver+0x55/0xd0
 [<ffffffff8137283c>] driver_unregister+0x2c/0x50
 [<ffffffff8131ca02>] pnp_unregister_driver+0x12/0x20
 [<ffffffffa06f347c>] cleanup_ipmi_si+0xbc/0xf0 [ipmi_si]
 [<ffffffff810c33f2>] SyS_delete_module+0x132/0x1c0
 [<ffffffff81002ab9>] ? do_notify_resume+0x59/0x80
 [<ffffffff8157c45a>] ? int_signal+0x12/0x17
 [<ffffffff8157c1d2>] system_call_fastpath+0x16/0x1b
---[ end trace 70b4377268f85c23 ]---

list_del in cleanup_one_si() fails because the smi_info is already
removed when hotmod removing.

When ipmi interface is removed by hotmod, smi_info is removed by
cleanup_one_si(), but is is still set in drvdata. Therefore when rmmod
ipmi_si, ipmi_pnp_remove tries to remove it again and fails.

By this patch, a pointer to smi_info in drvdata is cleared when hotmod
removing so that it will be not accessed when rmmod.

changelog:
v2:
- Clear drvdata in cleanup_one_si
- Change subject

v1:
https://lkml.org/lkml/2014/9/8/741

Signed-off-by: Takao Indoh <indou.takao@jp.fujitsu.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
---
 drivers/char/ipmi/ipmi_si_intf.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 1c43f9a..5c4e1f6 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -3658,6 +3658,9 @@ static void cleanup_one_si(struct smi_info *to_clean)
 	if (!to_clean)
 		return;
 
+	if (to_clean->dev)
+		dev_set_drvdata(to_clean->dev, NULL);
+
 	list_del(&to_clean->link);
 
 	/* Tell the driver that we are shutting down. */
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-10-06 19:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-06 19:17 [PATCH 0/4] ipmi: various collected bug fixes minyard
2014-10-06 19:17 ` [PATCH 1/4] ipmi: Clean up the error handling for channel config errors minyard
2014-10-06 19:17 ` [PATCH 2/4] ipmi/of: Don't use unavailable interfaces minyard
2014-10-06 19:17 ` [PATCH 3/4] ipmi: work around gcc-4.9 build warning minyard
2014-10-06 19:17 ` [PATCH 4/4] ipmi: Clear drvdata when interface is removed minyard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).