Skip to contentSkip to conversation

cxgb4i : Avoid holding mutex in interrupt context

PATCH Applied Anish Bhatt 4 participants 8 messages Sep 16, 2014 – Oct 1, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cxgb4i : Avoid holding mutex in interrupt context

cxgbi_inet6addr_handler() can be called in interrupt context, so use rcu protected list while finding netdev

Applies on top of core-for-3.18

Fixes fc8d0590d914 ("libcxgbi: Add ipv6 api to driver")
Fixes 759a0cc5a3e1 ("cxgb4i: Add ipv6 code to driver, call into libcxgbi ipv6

api")

---
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c |  2 +-
 drivers/scsi/cxgbi/libcxgbi.c      | 57 ++++++++++++++++++++++++++++++++++----
 drivers/scsi/cxgbi/libcxgbi.h      |  3 ++
 3 files changed, 55 insertions(+), 7 deletions(-)
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +1 -1
index 79788a1..02e69e7 100644
@@ -1647,7 +1647,7 @@ static int cxgbi_inet6addr_handler(struct notifier_block *this,
 	if (event_dev->priv_flags & IFF_802_1Q_VLAN)
 		event_dev = vlan_dev_real_dev(event_dev);
 
-	cdev = cxgbi_device_find_by_netdev(event_dev, NULL);
+	cdev = cxgbi_device_find_by_netdev_rcu(event_dev, NULL);
 
 	if (!cdev)
 		return ret;
drivers/scsi/cxgbi/libcxgbi.c +51 -6

96 lines not on this page · raw message

drivers/scsi/cxgbi/libcxgbi.h +3 -0
index b3e6e75..1d98fad 100644
@@ -527,6 +527,7 @@ struct cxgbi_ports_map {
 #define CXGBI_FLAG_IPV4_SET		0x10
 struct cxgbi_device {
 	struct list_head list_head;
+	struct list_head rcu_node;
 	unsigned int flags;
 	struct net_device **ports;
 	void *lldev;
@@ -709,6 +710,8 @@ void cxgbi_device_unregister(struct cxgbi_device *);
 void cxgbi_device_unregister_all(unsigned int flag);
 struct cxgbi_device *cxgbi_device_find_by_lldev(void *);
 struct cxgbi_device *cxgbi_device_find_by_netdev(struct net_device *, int *);
+struct cxgbi_device *cxgbi_device_find_by_netdev_rcu(struct net_device *,
+						     int *);
 int cxgbi_hbas_add(struct cxgbi_device *, u64, unsigned int,
 			struct scsi_host_template *,
 			struct scsi_transport_template *);
Signature · 1 line
2.1.0
#1 lore raw

Pinging for visibility
-Anish
________________________________________
From: Anish Bhatt [[email protected]]
Sent: Monday, September 15, 2014 5:44 PM
To: [email protected]
Cc: [email protected]; [email protected]; Karen Xie; Manoj Malviya; Anish Bhatt
Subject: [PATCH scsi] cxgb4i : Avoid holding mutex in interrupt context

cxgbi_inet6addr_handler() can be called in interrupt context, so use rcu protected list while finding netdev

Applies on top of core-for-3.18

Fixes fc8d0590d914 ("libcxgbi: Add ipv6 api to driver")
Fixes 759a0cc5a3e1 ("cxgb4i: Add ipv6 code to driver, call into libcxgbi ipv6

api")

---
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c |  2 +-
 drivers/scsi/cxgbi/libcxgbi.c      | 57 ++++++++++++++++++++++++++++++++++----
 drivers/scsi/cxgbi/libcxgbi.h      |  3 ++
 3 files changed, 55 insertions(+), 7 deletions(-)
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +1 -1
index 79788a1..02e69e7 100644
@@ -1647,7 +1647,7 @@ static int cxgbi_inet6addr_handler(struct notifier_block *this,
        if (event_dev->priv_flags & IFF_802_1Q_VLAN)
                event_dev = vlan_dev_real_dev(event_dev);
 
-       cdev = cxgbi_device_find_by_netdev(event_dev, NULL);
+       cdev = cxgbi_device_find_by_netdev_rcu(event_dev, NULL);
 
        if (!cdev)
                return ret;
drivers/scsi/cxgbi/libcxgbi.c +51 -6

96 lines not on this page · raw message

drivers/scsi/cxgbi/libcxgbi.h +3 -0
index b3e6e75..1d98fad 100644
@@ -527,6 +527,7 @@ struct cxgbi_ports_map {
 #define CXGBI_FLAG_IPV4_SET            0x10
 struct cxgbi_device {
        struct list_head list_head;
+       struct list_head rcu_node;
        unsigned int flags;
        struct net_device **ports;
        void *lldev;
@@ -709,6 +710,8 @@ void cxgbi_device_unregister(struct cxgbi_device *);
 void cxgbi_device_unregister_all(unsigned int flag);
 struct cxgbi_device *cxgbi_device_find_by_lldev(void *);
 struct cxgbi_device *cxgbi_device_find_by_netdev(struct net_device *, int *);
+struct cxgbi_device *cxgbi_device_find_by_netdev_rcu(struct net_device *,
+                                                    int *);
 int cxgbi_hbas_add(struct cxgbi_device *, u64, unsigned int,
                        struct scsi_host_template *,
                        struct scsi_transport_template *);

--
2.1.0

author Applied
#3 lore raw

Little late, but I was hoping this would be pushed as part of fixes to 3.17. Is it too late for that ?
-Anish
________________________________________
From: Christoph Hellwig [[email protected]]
Sent: Monday, September 22, 2014 7:45 AM
To: Anish Bhatt
Cc: [email protected]; [email protected]; Karen Xie; Manoj Malviya
Subject: Re: [PATCH scsi] cxgb4i : Avoid holding mutex in interrupt context

Thanks,

applied.

#4 lore raw
Quoted 2 lines · Anish Bhatt

Little late, but I was hoping this would be pushed as part of fixes to 3.17. Is it too late for that ?

It's in the drivers-for-3.18 tree as there was no indication you wanted it for 3.17. In fact the description said "Applies on top of core-for-3.18". You can try to persuade James to cherry pick if for 3.17, but given how late we are in the cycle that might need very good argument. You can always send it to [email protected] as soon as Linus pulls the SCSI update for 3.18, though.

#5 lore raw

James,
This is bugfix and prevents a "scheduling while atomic" bug that can be
hit when using an ipv6 address with cxgb4i, and can possibly be seen without Chelsio hardware. Could this be cherry picked for 3.17 please ?

Christoph,
My bad, this is a bugfix for code that was added for 3.17, and I assumed the
bugfixes would automatically be picked for the next rc. If James doesn't pick
this up, I'll send it to stable when appropriate.
-Anish
________________________________________
From: Christoph Hellwig [[email protected]]
Sent: Wednesday, October 01, 2014 12:49 AM
To: Anish Bhatt
Cc: Christoph Hellwig; [email protected]; [email protected]; Karen Xie; Manoj Malviya
Subject: Re: [PATCH scsi] cxgb4i : Avoid holding mutex in interrupt context

Quoted 2 lines · Anish Bhatt

Little late, but I was hoping this would be pushed as part of fixes to 3.17. Is it too late for that ?

It's in the drivers-for-3.18 tree as there was no indication you wanted it for 3.17. In fact the description said "Applies on top of core-for-3.18". You can try to persuade James to cherry pick if for 3.17, but given how late we are in the cycle that might need very good argument. You can always send it to [email protected] as soon as Linus pulls the SCSI update for 3.18, though.

maintainer
#6 lore raw
Quoted 4 lines · Anish Bhatt

James,
This is bugfix and prevents a "scheduling while atomic" bug that can be
hit when using an ipv6 address with cxgb4i, and can possibly be seen without Chelsio hardware. Could this be cherry picked for 3.17 please ?

Can you describe the bug it's fixing (what are the consequences) and how often is it seen?

If it's not something everyone hits, it may be better to go via stable, because the code change is quite large, so validating that nothing else breaks with it at this stage (a week away from release) is quite important.

Quoted 4 lines

Christoph,
My bad, this is a bugfix for code that was added for 3.17, and I assumed the
bugfixes would automatically be picked for the next rc. If James doesn't pick this up, I'll send it to stable when appropriate.

You said in your change log:

Applies on top of core-for-3.18

So the natural assumption would be this is for the merge window queue.

James

#7 lore raw

James, the bug is that with iscsi running, if ipv6 is provisioned on system, the kernel would oops on "scheduling while atomic". So it could be hit easily if ipv6 is used.

The changeset does look big, but it really just split a list original protected by mutex lock into two list, The 2nd list uses rcu lock.

Karen

________________________________________
From: James Bottomley [[email protected]]
Sent: Wednesday, October 01, 2014 4:36 AM
To: Anish Bhatt
Cc: Christoph Hellwig; [email protected]; Karen Xie; Manoj Malviya
Subject: Re: [PATCH scsi] cxgb4i : Avoid holding mutex in interrupt context

Quoted 4 lines · Anish Bhatt

James,
This is bugfix and prevents a "scheduling while atomic" bug that can be
hit when using an ipv6 address with cxgb4i, and can possibly be seen without Chelsio hardware. Could this be cherry picked for 3.17 please ?

Can you describe the bug it's fixing (what are the consequences) and how often is it seen?

If it's not something everyone hits, it may be better to go via stable, because the code change is quite large, so validating that nothing else breaks with it at this stage (a week away from release) is quite important.

Quoted 4 lines

Christoph,
My bad, this is a bugfix for code that was added for 3.17, and I assumed the
bugfixes would automatically be picked for the next rc. If James doesn't pick this up, I'll send it to stable when appropriate.

You said in your change log:

Applies on top of core-for-3.18

So the natural assumption would be this is for the merge window queue.

James