All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org,
	linux-pm@lists.linux-foundation.org
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>,
	Ursula Braun <ursula.braun@de.ibm.com>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: [patch 27/38] iucv: establish reboot notifier
Date: Thu, 04 Jun 2009 18:19:14 +0200	[thread overview]
Message-ID: <20090604161906.066208246@de.ibm.com> (raw)
In-Reply-To: 20090604161847.513682672@de.ibm.com

[-- Attachment #1: pm_iucv_reboot.patch --]
[-- Type: text/plain, Size: 8521 bytes --]

From: Ursula Braun <ursula.braun@de.ibm.com>

To guarantee a proper cleanup, patch adds a reboot notifier to
the iucv base code, which disables iucv interrupts, shuts down
established iucv pathes, and removes iucv declarations for z/VM.

Checks have to be added to the iucv-API functions, whether 
iucv-buffers removed at reboot time are still declared.

Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---
 net/iucv/iucv.c |   89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 87 insertions(+), 2 deletions(-)

Index: linux-2.6/net/iucv/iucv.c
===================================================================
--- linux-2.6.orig/net/iucv/iucv.c
+++ linux-2.6/net/iucv/iucv.c
@@ -1,7 +1,8 @@
 /*
  * IUCV base infrastructure.
  *
- * Copyright 2001, 2006 IBM Deutschland Entwicklung GmbH, IBM Corporation
+ * Copyright IBM Corp. 2001, 2009
+ *
  * Author(s):
  *    Original source:
  *	Alan Altmark (Alan_Altmark@us.ibm.com)	Sept. 2000
@@ -45,6 +46,7 @@
 #include <linux/err.h>
 #include <linux/device.h>
 #include <linux/cpu.h>
+#include <linux/reboot.h>
 #include <net/iucv/iucv.h>
 #include <asm/atomic.h>
 #include <asm/ebcdic.h>
@@ -758,6 +760,28 @@ void iucv_unregister(struct iucv_handler
 }
 EXPORT_SYMBOL(iucv_unregister);
 
+static int iucv_reboot_event(struct notifier_block *this,
+			     unsigned long event, void *ptr)
+{
+	int i, rc;
+
+	get_online_cpus();
+	on_each_cpu(iucv_block_cpu, NULL, 1);
+	preempt_disable();
+	for (i = 0; i < iucv_max_pathid; i++) {
+		if (iucv_path_table[i])
+			rc = iucv_sever_pathid(i, NULL);
+	}
+	preempt_enable();
+	put_online_cpus();
+	iucv_disable();
+	return NOTIFY_DONE;
+}
+
+static struct notifier_block iucv_reboot_notifier = {
+	.notifier_call = iucv_reboot_event,
+};
+
 /**
  * iucv_path_accept
  * @path: address of iucv path structure
@@ -777,6 +801,10 @@ int iucv_path_accept(struct iucv_path *p
 	int rc;
 
 	local_bh_disable();
+	if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) {
+		rc = -EIO;
+		goto out;
+	}
 	/* Prepare parameter block. */
 	parm = iucv_param[smp_processor_id()];
 	memset(parm, 0, sizeof(union iucv_param));
@@ -792,6 +820,7 @@ int iucv_path_accept(struct iucv_path *p
 		path->msglim = parm->ctrl.ipmsglim;
 		path->flags = parm->ctrl.ipflags1;
 	}
+out:
 	local_bh_enable();
 	return rc;
 }
@@ -821,6 +850,10 @@ int iucv_path_connect(struct iucv_path *
 
 	spin_lock_bh(&iucv_table_lock);
 	iucv_cleanup_queue();
+	if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) {
+		rc = -EIO;
+		goto out;
+	}
 	parm = iucv_param[smp_processor_id()];
 	memset(parm, 0, sizeof(union iucv_param));
 	parm->ctrl.ipmsglim = path->msglim;
@@ -855,6 +888,7 @@ int iucv_path_connect(struct iucv_path *
 			rc = -EIO;
 		}
 	}
+out:
 	spin_unlock_bh(&iucv_table_lock);
 	return rc;
 }
@@ -876,12 +910,17 @@ int iucv_path_quiesce(struct iucv_path *
 	int rc;
 
 	local_bh_disable();
+	if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) {
+		rc = -EIO;
+		goto out;
+	}
 	parm = iucv_param[smp_processor_id()];
 	memset(parm, 0, sizeof(union iucv_param));
 	if (userdata)
 		memcpy(parm->ctrl.ipuser, userdata, sizeof(parm->ctrl.ipuser));
 	parm->ctrl.ippathid = path->pathid;
 	rc = iucv_call_b2f0(IUCV_QUIESCE, parm);
+out:
 	local_bh_enable();
 	return rc;
 }
@@ -903,12 +942,17 @@ int iucv_path_resume(struct iucv_path *p
 	int rc;
 
 	local_bh_disable();
+	if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) {
+		rc = -EIO;
+		goto out;
+	}
 	parm = iucv_param[smp_processor_id()];
 	memset(parm, 0, sizeof(union iucv_param));
 	if (userdata)
 		memcpy(parm->ctrl.ipuser, userdata, sizeof(parm->ctrl.ipuser));
 	parm->ctrl.ippathid = path->pathid;
 	rc = iucv_call_b2f0(IUCV_RESUME, parm);
+out:
 	local_bh_enable();
 	return rc;
 }
@@ -927,6 +971,10 @@ int iucv_path_sever(struct iucv_path *pa
 	int rc;
 
 	preempt_disable();
+	if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) {
+		rc = -EIO;
+		goto out;
+	}
 	if (iucv_active_cpu != smp_processor_id())
 		spin_lock_bh(&iucv_table_lock);
 	rc = iucv_sever_pathid(path->pathid, userdata);
@@ -934,6 +982,7 @@ int iucv_path_sever(struct iucv_path *pa
 	list_del_init(&path->list);
 	if (iucv_active_cpu != smp_processor_id())
 		spin_unlock_bh(&iucv_table_lock);
+out:
 	preempt_enable();
 	return rc;
 }
@@ -956,6 +1005,10 @@ int iucv_message_purge(struct iucv_path 
 	int rc;
 
 	local_bh_disable();
+	if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) {
+		rc = -EIO;
+		goto out;
+	}
 	parm = iucv_param[smp_processor_id()];
 	memset(parm, 0, sizeof(union iucv_param));
 	parm->purge.ippathid = path->pathid;
@@ -967,6 +1020,7 @@ int iucv_message_purge(struct iucv_path 
 		msg->audit = (*(u32 *) &parm->purge.ipaudit) >> 8;
 		msg->tag = parm->purge.ipmsgtag;
 	}
+out:
 	local_bh_enable();
 	return rc;
 }
@@ -1043,6 +1097,10 @@ int __iucv_message_receive(struct iucv_p
 	if (msg->flags & IUCV_IPRMDATA)
 		return iucv_message_receive_iprmdata(path, msg, flags,
 						     buffer, size, residual);
+	if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) {
+		rc = -EIO;
+		goto out;
+	}
 	parm = iucv_param[smp_processor_id()];
 	memset(parm, 0, sizeof(union iucv_param));
 	parm->db.ipbfadr1 = (u32)(addr_t) buffer;
@@ -1058,6 +1116,7 @@ int __iucv_message_receive(struct iucv_p
 		if (residual)
 			*residual = parm->db.ipbfln1f;
 	}
+out:
 	return rc;
 }
 EXPORT_SYMBOL(__iucv_message_receive);
@@ -1111,6 +1170,10 @@ int iucv_message_reject(struct iucv_path
 	int rc;
 
 	local_bh_disable();
+	if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) {
+		rc = -EIO;
+		goto out;
+	}
 	parm = iucv_param[smp_processor_id()];
 	memset(parm, 0, sizeof(union iucv_param));
 	parm->db.ippathid = path->pathid;
@@ -1118,6 +1181,7 @@ int iucv_message_reject(struct iucv_path
 	parm->db.iptrgcls = msg->class;
 	parm->db.ipflags1 = (IUCV_IPTRGCLS | IUCV_IPFGMID | IUCV_IPFGPID);
 	rc = iucv_call_b2f0(IUCV_REJECT, parm);
+out:
 	local_bh_enable();
 	return rc;
 }
@@ -1145,6 +1209,10 @@ int iucv_message_reply(struct iucv_path 
 	int rc;
 
 	local_bh_disable();
+	if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) {
+		rc = -EIO;
+		goto out;
+	}
 	parm = iucv_param[smp_processor_id()];
 	memset(parm, 0, sizeof(union iucv_param));
 	if (flags & IUCV_IPRMDATA) {
@@ -1162,6 +1230,7 @@ int iucv_message_reply(struct iucv_path 
 		parm->db.iptrgcls = msg->class;
 	}
 	rc = iucv_call_b2f0(IUCV_REPLY, parm);
+out:
 	local_bh_enable();
 	return rc;
 }
@@ -1190,6 +1259,10 @@ int __iucv_message_send(struct iucv_path
 	union iucv_param *parm;
 	int rc;
 
+	if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) {
+		rc = -EIO;
+		goto out;
+	}
 	parm = iucv_param[smp_processor_id()];
 	memset(parm, 0, sizeof(union iucv_param));
 	if (flags & IUCV_IPRMDATA) {
@@ -1212,6 +1285,7 @@ int __iucv_message_send(struct iucv_path
 	rc = iucv_call_b2f0(IUCV_SEND, parm);
 	if (!rc)
 		msg->id = parm->db.ipmsgid;
+out:
 	return rc;
 }
 EXPORT_SYMBOL(__iucv_message_send);
@@ -1272,6 +1346,10 @@ int iucv_message_send2way(struct iucv_pa
 	int rc;
 
 	local_bh_disable();
+	if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) {
+		rc = -EIO;
+		goto out;
+	}
 	parm = iucv_param[smp_processor_id()];
 	memset(parm, 0, sizeof(union iucv_param));
 	if (flags & IUCV_IPRMDATA) {
@@ -1297,6 +1375,7 @@ int iucv_message_send2way(struct iucv_pa
 	rc = iucv_call_b2f0(IUCV_SEND, parm);
 	if (!rc)
 		msg->id = parm->db.ipmsgid;
+out:
 	local_bh_enable();
 	return rc;
 }
@@ -1738,15 +1817,20 @@ static int __init iucv_init(void)
 	rc = register_hotcpu_notifier(&iucv_cpu_notifier);
 	if (rc)
 		goto out_free;
+	rc = register_reboot_notifier(&iucv_reboot_notifier);
+	if (rc)
+		goto out_cpu;
 	ASCEBC(iucv_error_no_listener, 16);
 	ASCEBC(iucv_error_no_memory, 16);
 	ASCEBC(iucv_error_pathid, 16);
 	iucv_available = 1;
 	rc = bus_register(&iucv_bus);
 	if (rc)
-		goto out_cpu;
+		goto out_reboot;
 	return 0;
 
+out_reboot:
+	unregister_reboot_notifier(&iucv_reboot_notifier);
 out_cpu:
 	unregister_hotcpu_notifier(&iucv_cpu_notifier);
 out_free:
@@ -1781,6 +1865,7 @@ static void __exit iucv_exit(void)
 	list_for_each_entry_safe(p, n, &iucv_work_queue, list)
 		kfree(p);
 	spin_unlock_irq(&iucv_queue_lock);
+	unregister_reboot_notifier(&iucv_reboot_notifier);
 	unregister_hotcpu_notifier(&iucv_cpu_notifier);
 	for_each_possible_cpu(cpu) {
 		kfree(iucv_param_irq[cpu]);

-- 
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.

  parent reply	other threads:[~2009-06-04 16:19 UTC|newest]

Thread overview: 115+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-04 16:18 [patch 00/38] power management / hibernate support for s390 Martin Schwidefsky
2009-06-04 16:18 ` [patch 01/38] pm: Move nvs routines into a seperate file Martin Schwidefsky
2009-06-08  6:35   ` Pavel Machek
2009-06-08 15:36     ` Cornelia Huck
2009-06-08 18:48       ` Rafael J. Wysocki
2009-06-09  8:40         ` [PATCH v2] " Cornelia Huck
2009-06-09  8:40         ` Cornelia Huck
2009-06-09 19:58           ` Pavel Machek
2009-06-09 19:58           ` Pavel Machek
2009-06-09 23:09           ` Rafael J. Wysocki
2009-06-11 13:32             ` Heiko Carstens
2009-06-11 13:32             ` Heiko Carstens
2009-06-11 19:58               ` Rafael J. Wysocki
2009-06-11 19:58               ` Rafael J. Wysocki
2009-06-11 21:11               ` Pavel Machek
2009-06-11 21:11               ` Pavel Machek
2009-06-11 21:46                 ` Rafael J. Wysocki
2009-06-11 21:46                 ` Rafael J. Wysocki
2009-06-11 22:05                   ` Pavel Machek
2009-06-11 22:05                   ` Pavel Machek
2009-06-11 22:29                     ` Rafael J. Wysocki
2009-06-11 22:29                     ` Rafael J. Wysocki
2009-06-11 23:22                       ` Pavel Machek
2009-06-11 23:28                         ` Pavel Machek
2009-06-11 23:28                         ` Pavel Machek
2009-06-11 23:22                       ` Pavel Machek
2009-06-09 23:09           ` Rafael J. Wysocki
2009-06-08 18:48       ` [patch 01/38] " Rafael J. Wysocki
2009-06-08 15:36     ` Cornelia Huck
2009-06-08  6:35   ` Pavel Machek
2009-06-04 16:18 ` Martin Schwidefsky
2009-06-04 16:18 ` [patch 02/38] dasd: forward internal errors to dasd_sleep_on caller Martin Schwidefsky
2009-06-04 16:18 ` Martin Schwidefsky
2009-06-04 16:18 ` [patch 03/38] iucv: provide second per-cpu IUCV command parameter block Martin Schwidefsky
2009-06-04 16:18 ` Martin Schwidefsky
2009-06-04 16:18 ` [patch 04/38] device irq power management Martin Schwidefsky
2009-06-04 16:18 ` Martin Schwidefsky
2009-06-04 16:18 ` [patch 05/38] s390: hibernation support for s390 Martin Schwidefsky
2009-06-04 16:18 ` Martin Schwidefsky
2009-06-08  6:44   ` Pavel Machek
2009-06-09 13:34     ` Hans-Joachim Picht
2009-06-09 13:34     ` Hans-Joachim Picht
2009-06-09 19:59       ` Pavel Machek
2009-06-10  9:48         ` Hans-Joachim Picht
2009-06-10  9:48         ` Hans-Joachim Picht
2009-06-09 19:59       ` Pavel Machek
2009-06-12  6:37     ` Martin Schwidefsky
2009-06-12  6:37     ` Martin Schwidefsky
2009-06-08  6:44   ` Pavel Machek
2009-06-04 16:18 ` [patch 06/38] pm: ccw bus power management callbacks Martin Schwidefsky
2009-06-04 16:18 ` Martin Schwidefsky
2009-06-04 16:18 ` [patch 07/38] pm: ccwgroup " Martin Schwidefsky
2009-06-04 16:18 ` Martin Schwidefsky
2009-06-04 16:18 ` [patch 08/38] pm: css " Martin Schwidefsky
2009-06-04 16:18 ` Martin Schwidefsky
2009-06-04 16:18 ` [patch 09/38] pm: io subchannel driver " Martin Schwidefsky
2009-06-04 16:18 ` Martin Schwidefsky
2009-06-04 16:18 ` [patch 10/38] pm: chsc " Martin Schwidefsky
2009-06-04 16:18 ` Martin Schwidefsky
2009-06-04 16:18 ` [patch 11/38] pm: dasd " Martin Schwidefsky
2009-06-04 16:18 ` Martin Schwidefsky
2009-06-04 16:18 ` [patch 12/38] pm: add kernel_page_present Martin Schwidefsky
2009-06-04 16:18 ` Martin Schwidefsky
2009-06-04 16:19 ` [patch 13/38] pm: xpram driver power management callbacks Martin Schwidefsky
2009-06-04 16:19 ` Martin Schwidefsky
2009-06-04 16:19 ` [patch 14/38] cio: force console function Martin Schwidefsky
2009-06-04 16:19 ` Martin Schwidefsky
2009-06-04 16:19 ` [patch 15/38] pm: con3215 power management callbacks Martin Schwidefsky
2009-06-04 16:19 ` Martin Schwidefsky
2009-06-04 16:19 ` [patch 16/38] pm: lcs driver " Martin Schwidefsky
2009-06-04 16:19 ` Martin Schwidefsky
2009-06-04 16:19 ` [patch 17/38] pm: qeth " Martin Schwidefsky
2009-06-04 16:19 ` Martin Schwidefsky
2009-06-04 16:19 ` [patch 18/38] pm: ctcm " Martin Schwidefsky
2009-06-04 16:19 ` Martin Schwidefsky
2009-06-04 16:19 ` [patch 19/38] pm: claw " Martin Schwidefsky
2009-06-04 16:19 ` Martin Schwidefsky
2009-06-04 16:19 ` [patch 20/38] pm: zfcp " Martin Schwidefsky
2009-06-04 16:19 ` Martin Schwidefsky
2009-06-04 16:19 ` [patch 21/38] pm: vmwatchdog " Martin Schwidefsky
2009-06-04 16:19 ` Martin Schwidefsky
2009-06-04 16:19 ` [patch 22/38] pm: appldata " Martin Schwidefsky
2009-06-04 16:19 ` Martin Schwidefsky
2009-06-04 16:19 ` [patch 23/38] pm: vmur driver " Martin Schwidefsky
2009-06-04 16:19 ` Martin Schwidefsky
2009-06-04 16:19 ` [patch 24/38] pm: vmlogrdr " Martin Schwidefsky
2009-06-04 16:19 ` Martin Schwidefsky
2009-06-04 16:19 ` [patch 25/38] pm: tape " Martin Schwidefsky
2009-06-04 16:19 ` Martin Schwidefsky
2009-06-04 16:19 ` [patch 26/38] pm: power management support for SCLP drivers Martin Schwidefsky
2009-06-04 16:19 ` Martin Schwidefsky
2009-06-04 16:19 ` [patch 27/38] iucv: establish reboot notifier Martin Schwidefsky
2009-06-04 16:19 ` Martin Schwidefsky [this message]
2009-06-04 16:19 ` [patch 28/38] pm: iucv power management callbacks Martin Schwidefsky
2009-06-04 16:19 ` Martin Schwidefsky
2009-06-04 16:19 ` [patch 29/38] pm: netiucv " Martin Schwidefsky
2009-06-04 16:19 ` Martin Schwidefsky
2009-06-04 16:19 ` [patch 30/38] PM: af_iucv " Martin Schwidefsky
2009-06-04 16:19 ` Martin Schwidefsky
2009-06-04 16:19 ` [patch 31/38] pm: hvc_iucv " Martin Schwidefsky
2009-06-04 16:19 ` Martin Schwidefsky
2009-06-04 16:19 ` [patch 32/38] pm: smsgiucv " Martin Schwidefsky
2009-06-04 16:19 ` Martin Schwidefsky
2009-06-04 16:19 ` [patch 33/38] pm: con3270 " Martin Schwidefsky
2009-06-04 16:19 ` Martin Schwidefsky
2009-06-04 16:19 ` [patch 34/38] pm: memory hotplug " Martin Schwidefsky
2009-06-04 16:19 ` Martin Schwidefsky
2009-06-04 16:19 ` [patch 35/38] pm: monwriter " Martin Schwidefsky
2009-06-04 16:19 ` Martin Schwidefsky
2009-06-04 16:19 ` [patch 36/38] pm: monreader " Martin Schwidefsky
2009-06-04 16:19 ` Martin Schwidefsky
2009-06-04 16:19 ` [patch 37/38] pm: dcssblk " Martin Schwidefsky
2009-06-04 16:19 ` Martin Schwidefsky
2009-06-04 16:19 ` [patch 38/38] pm: ap bus " Martin Schwidefsky
2009-06-04 16:19 ` Martin Schwidefsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090604161906.066208246@de.ibm.com \
    --to=schwidefsky@de.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=ursula.braun@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.