netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 1/7] qeth: ungrouping a device must not be interruptible
       [not found] <20070827172731.370533000@linux.vnet.ibm.com>
@ 2007-08-27 17:27 ` Ursula Braun
  2007-08-27 17:27 ` [patch 2/7] qeth: enforce a rate limit for inbound scatter gather messages Ursula Braun
  2007-08-27 17:27 ` [patch 3/7] qeth: dont return the return values of void functions Ursula Braun
  2 siblings, 0 replies; 3+ messages in thread
From: Ursula Braun @ 2007-08-27 17:27 UTC (permalink / raw)
  To: jgarzik, netdev, linux-s390; +Cc: frank.blaschka

[-- Attachment #1: 703-qeth-ungroup.diff --]
[-- Type: text/plain, Size: 1494 bytes --]

From: Ursula Braun <braunu@de.ibm.com>

Problem:
A recovery thread must not be active when device is removed.
In qeth_remove_device() an interruptible wait operation is used
to wait until a qeth recovery thread is finished. If a user really
interrupts the ungroup operation of a qeth device while a recovery
is running, cio and qeth are out of sync (device already removed
from cio, but kept in qeth). A following module unload of qeth
results in a kernel OOPS here.

Solution:
Do not allow interruption of ungroup operation to guarantee
finishing of a potentially running qeth recovery thread.

Signed-off-by: Ursula Braun <braunu@de.ibm.com>
---

 drivers/s390/net/qeth_main.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Index: linux-2.6-uschi/drivers/s390/net/qeth_main.c
===================================================================
--- linux-2.6-uschi.orig/drivers/s390/net/qeth_main.c
+++ linux-2.6-uschi/drivers/s390/net/qeth_main.c
@@ -561,7 +561,7 @@ qeth_set_offline(struct ccwgroup_device 
 }
 
 static int
-qeth_wait_for_threads(struct qeth_card *card, unsigned long threads);
+qeth_threads_running(struct qeth_card *card, unsigned long threads);
 
 
 static void
@@ -576,8 +576,7 @@ qeth_remove_device(struct ccwgroup_devic
 	if (!card)
 		return;
 
-	if (qeth_wait_for_threads(card, 0xffffffff))
-		return;
+	wait_event(card->wait_q, qeth_threads_running(card, 0xffffffff) == 0);
 
 	if (cgdev->state == CCWGROUP_ONLINE){
 		card->use_hard_stop = 1;

-- 

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

* [patch 2/7] qeth: enforce a rate limit for inbound scatter gather messages
       [not found] <20070827172731.370533000@linux.vnet.ibm.com>
  2007-08-27 17:27 ` [patch 1/7] qeth: ungrouping a device must not be interruptible Ursula Braun
@ 2007-08-27 17:27 ` Ursula Braun
  2007-08-27 17:27 ` [patch 3/7] qeth: dont return the return values of void functions Ursula Braun
  2 siblings, 0 replies; 3+ messages in thread
From: Ursula Braun @ 2007-08-27 17:27 UTC (permalink / raw)
  To: jgarzik, netdev, linux-s390; +Cc: frank.blaschka

[-- Attachment #1: 704-qeth-rate-limit.diff --]
[-- Type: text/plain, Size: 1369 bytes --]

From: Frank Blaschka <frank.blaschka@de.ibm.com>

under memory pressure scatter gather mode switching messages must be
rate limited.

Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: Ursula Braun <braunu@de.ibm.com>
---

 drivers/s390/net/qeth_main.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Index: linux-2.6-uschi/drivers/s390/net/qeth_main.c
===================================================================
--- linux-2.6-uschi.orig/drivers/s390/net/qeth_main.c
+++ linux-2.6-uschi/drivers/s390/net/qeth_main.c
@@ -2803,13 +2803,16 @@ qeth_queue_input_buffer(struct qeth_card
 		if (newcount < count) {
 			/* we are in memory shortage so we switch back to
 			   traditional skb allocation and drop packages */
-			if (atomic_cmpxchg(&card->force_alloc_skb, 0, 1))
-				printk(KERN_WARNING
-					"qeth: switch to alloc skb\n");
+			if (!atomic_read(&card->force_alloc_skb) &&
+			    net_ratelimit())
+				PRINT_WARN("Switch to alloc skb\n");
+			atomic_set(&card->force_alloc_skb, 3);
 			count = newcount;
 		} else {
-			if (atomic_cmpxchg(&card->force_alloc_skb, 1, 0))
-				printk(KERN_WARNING "qeth: switch to sg\n");
+			if ((atomic_read(&card->force_alloc_skb) == 1) &&
+			    net_ratelimit())
+				PRINT_WARN("Switch to sg\n");
+			atomic_add_unless(&card->force_alloc_skb, -1, 0);
 		}
 
 		/*

-- 

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

* [patch 3/7] qeth: dont return the return values of void functions.
       [not found] <20070827172731.370533000@linux.vnet.ibm.com>
  2007-08-27 17:27 ` [patch 1/7] qeth: ungrouping a device must not be interruptible Ursula Braun
  2007-08-27 17:27 ` [patch 2/7] qeth: enforce a rate limit for inbound scatter gather messages Ursula Braun
@ 2007-08-27 17:27 ` Ursula Braun
  2 siblings, 0 replies; 3+ messages in thread
From: Ursula Braun @ 2007-08-27 17:27 UTC (permalink / raw)
  To: jgarzik, netdev, linux-s390; +Cc: frank.blaschka, Heiko Carstens

[-- Attachment #1: 705-qeth-return.diff --]
[-- Type: text/plain, Size: 1619 bytes --]

From: Heiko Carstens <heiko.carstens@de.ibm.com>

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Ursula Braun <braunu@de.ibm.com>
---

 drivers/s390/net/qeth.h     |    4 ++--
 drivers/s390/net/qeth_sys.c |    8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

Index: linux-2.6-uschi/drivers/s390/net/qeth.h
===================================================================
--- linux-2.6-uschi.orig/drivers/s390/net/qeth.h
+++ linux-2.6-uschi/drivers/s390/net/qeth.h
@@ -1178,9 +1178,9 @@ qeth_ipaddr_to_string(enum qeth_prot_ver
 		      char *buf)
 {
 	if (proto == QETH_PROT_IPV4)
-		return qeth_ipaddr4_to_string(addr, buf);
+		qeth_ipaddr4_to_string(addr, buf);
 	else if (proto == QETH_PROT_IPV6)
-		return qeth_ipaddr6_to_string(addr, buf);
+		qeth_ipaddr6_to_string(addr, buf);
 }
 
 static inline int
Index: linux-2.6-uschi/drivers/s390/net/qeth_sys.c
===================================================================
--- linux-2.6-uschi.orig/drivers/s390/net/qeth_sys.c
+++ linux-2.6-uschi/drivers/s390/net/qeth_sys.c
@@ -1760,10 +1760,10 @@ qeth_remove_device_attributes(struct dev
 {
 	struct qeth_card *card = dev->driver_data;
 
-	if (card->info.type == QETH_CARD_TYPE_OSN)
-		return sysfs_remove_group(&dev->kobj,
-					  &qeth_osn_device_attr_group);
-
+	if (card->info.type == QETH_CARD_TYPE_OSN) {
+		sysfs_remove_group(&dev->kobj, &qeth_osn_device_attr_group);
+		return;
+	}
 	sysfs_remove_group(&dev->kobj, &qeth_device_attr_group);
 	sysfs_remove_group(&dev->kobj, &qeth_device_ipato_group);
 	sysfs_remove_group(&dev->kobj, &qeth_device_vipa_group);

-- 

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

end of thread, other threads:[~2007-08-27 17:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20070827172731.370533000@linux.vnet.ibm.com>
2007-08-27 17:27 ` [patch 1/7] qeth: ungrouping a device must not be interruptible Ursula Braun
2007-08-27 17:27 ` [patch 2/7] qeth: enforce a rate limit for inbound scatter gather messages Ursula Braun
2007-08-27 17:27 ` [patch 3/7] qeth: dont return the return values of void functions Ursula Braun

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).