All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Liu, Chuansheng" <chuansheng.liu@intel.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Yanmin Zhang <yanmin_zhang@linux.intel.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>
Subject: RE: [PATCH] Fix the race between smp_call_function and CPU booting
Date: Thu, 22 Mar 2012 00:59:40 +0000	[thread overview]
Message-ID: <27240C0AC20F114CBF8149A2696CBE4A05C092@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <1332332739.18960.488.camel@twins>

Below is the complete test patch. Just run the simpl_loop_onoffline.sh and simpl_loop_smpcalling.sh concurrently
to reproduce the race.

From: liu chuansheng <chuansheng.liu@intel.com>
Subject: [PATCH] Test scripts to verify the race between CPU booting and smp_call

Signed-off-by: liu chuansheng <chuansheng.liu@intel.com>
---
 drivers/misc/Makefile            |    1 +
 drivers/misc/smp_call_test.c     |   61 ++++++++++++++++++++++++++++++++++++++
 scripts/simpl_loop_onoffline.sh  |    5 +++
 scripts/simpl_loop_smpcalling.sh |    5 +++
 4 files changed, 72 insertions(+), 0 deletions(-)
 create mode 100644 drivers/misc/smp_call_test.c
 create mode 100644 scripts/simpl_loop_onoffline.sh
 create mode 100644 scripts/simpl_loop_smpcalling.sh

diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 571ffd1..003f883 100755
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -59,3 +59,4 @@ obj-$(CONFIG_MID_I2S_DEV)     += mid_i2s_dev/
 obj-$(CONFIG_EMMC_IPANIC)      += emmc_ipanic.o
 obj-$(CONFIG_SCU_LOGGING)      += intel_fabric_logging.o
 obj-$(CONFIG_UUID)     += uuid.o
+obj-y                          += smp_call_test.o
diff --git a/drivers/misc/smp_call_test.c b/drivers/misc/smp_call_test.c
new file mode 100644
index 0000000..95a14fc
--- /dev/null
+++ b/drivers/misc/smp_call_test.c
@@ -0,0 +1,61 @@
+/*
+ * drivers/misc/smp_call_test.c
+ *
+ * Author: chuansheng.liu@intel.com
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/device.h>
+#include <linux/types.h>
+#include <linux/delay.h>
+#include <linux/sched.h>
+#include <linux/debugfs.h>
+#include <linux/fs.h>
+#include <linux/proc_fs.h>
+
+static int smp_call_dbg_get(void *data, u64 *val)
+{
+       return 0;
+}
+
+static void smp_call_func(void *info)
+{
+       return;
+}
+
+static int smp_call_dbg_set(void *data, u64 val)
+{
+       smp_call_function(smp_call_func, NULL, 1);
+       printk(KERN_ERR "test smp_call_function\n");
+       return 0;
+}
+
+
+DEFINE_SIMPLE_ATTRIBUTE(smp_call_dbg_fops, smp_call_dbg_get, smp_call_dbg_set, "%llu\n");
+
+
+int __init smp_call_test_init(void)
+{
+       debugfs_create_file("smp_call_test", 0644, NULL, NULL, &smp_call_dbg_fops);
+       return 0;
+}
+
+module_init(smp_call_test_init);
+
diff --git a/scripts/simpl_loop_onoffline.sh b/scripts/simpl_loop_onoffline.sh
new file mode 100644
index 0000000..c2c640d
--- /dev/null
+++ b/scripts/simpl_loop_onoffline.sh
@@ -0,0 +1,5 @@
+while true
+do
+ echo 0 > /sys/devices/system/cpu/cpu1/online
+ echo 1 > /sys/devices/system/cpu/cpu1/online
+done
diff --git a/scripts/simpl_loop_smpcalling.sh b/scripts/simpl_loop_smpcalling.sh
new file mode 100644
index 0000000..37cef74
--- /dev/null
+++ b/scripts/simpl_loop_smpcalling.sh
@@ -0,0 +1,5 @@
+while true
+do
+echo 1 > /sys/kernel/debug/smp_call_test
+usleep 500000
+done
-- 
1.7.0.4

> -----Original Message-----
> From: Peter Zijlstra [mailto:peterz@infradead.org]
> Sent: Wednesday, March 21, 2012 8:26 PM
> To: Liu, Chuansheng
> Cc: linux-kernel@vger.kernel.org; Yanmin Zhang; tglx@linutronix.de
> Subject: RE: [PATCH] Fix the race between smp_call_function and CPU booting
> 
> 
> Can you send me your exact kernel patch (the sysfs knob you use to trigger this)
> and test scripts?

  reply	other threads:[~2012-03-22  0:59 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-12  9:27 [PATCH] Fix the race between smp_call_function and CPU booting Liu, Chuansheng
2012-03-12  9:32 ` Peter Zijlstra
2012-03-13  6:43   ` Liu, Chuansheng
2012-03-12  9:58 ` Peter Zijlstra
2012-03-13  6:46   ` Liu, Chuansheng
2012-03-13 15:57     ` Peter Zijlstra
2012-03-14  6:27       ` Liu, Chuansheng
2012-03-14  9:43         ` Peter Zijlstra
2012-03-15  0:11           ` Liu, Chuansheng
2012-03-15 10:46             ` Peter Zijlstra
2012-03-16  6:24               ` Liu, Chuansheng
2012-03-16  9:49                 ` Peter Zijlstra
2012-03-19  0:58                   ` Liu, Chuansheng
2012-03-19 10:03                     ` Peter Zijlstra
2012-03-20  0:22                       ` Liu, Chuansheng
2012-03-20 12:17                         ` Peter Zijlstra
2012-03-20 13:14                           ` Srivatsa S. Bhat
2012-03-20 13:41                             ` Peter Zijlstra
2012-03-20 15:02                               ` Srivatsa S. Bhat
2012-03-21  5:59                           ` Liu, Chuansheng
2012-03-21  9:12                             ` Peter Zijlstra
2012-03-21 12:25                             ` Peter Zijlstra
2012-03-22  0:59                               ` Liu, Chuansheng [this message]
2012-03-23 10:25                                 ` Peter Zijlstra
2012-03-23 11:32                                   ` Liu, Chuansheng
2012-03-23 12:02                                     ` Peter Zijlstra
2012-03-23 12:06                                       ` Liu, Chuansheng
2012-03-23 12:13                                         ` Peter Zijlstra
2012-03-23 12:21                                           ` Liu, Chuansheng

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=27240C0AC20F114CBF8149A2696CBE4A05C092@SHSMSX101.ccr.corp.intel.com \
    --to=chuansheng.liu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=yanmin_zhang@linux.intel.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.