From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Greg KH <gregkh@linuxfoundation.org>,
Milton Miller <miltonm@bga.com>,
Paul Mackerras <paulus@samba.org>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: [ 65/85] powerpc: Make sure IPI handlers see data written by IPI senders
Date: Wed, 12 Sep 2012 16:36:48 -0700 [thread overview]
Message-ID: <20120912233548.543035462@linuxfoundation.org> (raw)
In-Reply-To: <20120912233541.747973832@linuxfoundation.org>
From: Greg KH <gregkh@linuxfoundation.org>
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Mackerras <paulus@samba.org>
commit 9fb1b36ca1234e64a5d1cc573175303395e3354d upstream.
We have been observing hangs, both of KVM guest vcpu tasks and more
generally, where a process that is woken doesn't properly wake up and
continue to run, but instead sticks in TASK_WAKING state. This
happens because the update of rq->wake_list in ttwu_queue_remote()
is not ordered with the update of ipi_message in
smp_muxed_ipi_message_pass(), and the reading of rq->wake_list in
scheduler_ipi() is not ordered with the reading of ipi_message in
smp_ipi_demux(). Thus it is possible for the IPI receiver not to see
the updated rq->wake_list and therefore conclude that there is nothing
for it to do.
In order to make sure that anything done before smp_send_reschedule()
is ordered before anything done in the resulting call to scheduler_ipi(),
this adds barriers in smp_muxed_message_pass() and smp_ipi_demux().
The barrier in smp_muxed_message_pass() is a full barrier to ensure that
there is a full ordering between the smp_send_reschedule() caller and
scheduler_ipi(). In smp_ipi_demux(), we use xchg() rather than
xchg_local() because xchg() includes release and acquire barriers.
Using xchg() rather than xchg_local() makes sense given that
ipi_message is not just accessed locally.
This moves the barrier between setting the message and calling the
cause_ipi() function into the individual cause_ipi implementations.
Most of them -- those that used outb, out_8 or similar -- already had
a full barrier because out_8 etc. include a sync before the MMIO
store. This adds an explicit barrier in the two remaining cases.
These changes made no measurable difference to the speed of IPIs as
measured using a simple ping-pong latency test across two CPUs on
different cores of a POWER7 machine.
The analysis of the reason why processes were not waking up properly
is due to Milton Miller.
Reported-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/powerpc/kernel/dbell.c | 2 ++
arch/powerpc/kernel/smp.c | 11 +++++++++--
arch/powerpc/sysdev/xics/icp-hv.c | 6 +++++-
3 files changed, 16 insertions(+), 3 deletions(-)
--- a/arch/powerpc/kernel/dbell.c
+++ b/arch/powerpc/kernel/dbell.c
@@ -28,6 +28,8 @@ void doorbell_setup_this_cpu(void)
void doorbell_cause_ipi(int cpu, unsigned long data)
{
+ /* Order previous accesses vs. msgsnd, which is treated as a store */
+ mb();
ppc_msgsnd(PPC_DBELL, 0, data);
}
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -215,8 +215,15 @@ void smp_muxed_ipi_message_pass(int cpu,
struct cpu_messages *info = &per_cpu(ipi_message, cpu);
char *message = (char *)&info->messages;
+ /*
+ * Order previous accesses before accesses in the IPI handler.
+ */
+ smp_mb();
message[msg] = 1;
- mb();
+ /*
+ * cause_ipi functions are required to include a full barrier
+ * before doing whatever causes the IPI.
+ */
smp_ops->cause_ipi(cpu, info->data);
}
@@ -228,7 +235,7 @@ irqreturn_t smp_ipi_demux(void)
mb(); /* order any irq clear */
do {
- all = xchg_local(&info->messages, 0);
+ all = xchg(&info->messages, 0);
#ifdef __BIG_ENDIAN
if (all & (1 << (24 - 8 * PPC_MSG_CALL_FUNCTION)))
--- a/arch/powerpc/sysdev/xics/icp-hv.c
+++ b/arch/powerpc/sysdev/xics/icp-hv.c
@@ -65,7 +65,11 @@ static inline void icp_hv_set_xirr(unsig
static inline void icp_hv_set_qirr(int n_cpu , u8 value)
{
int hw_cpu = get_hard_smp_processor_id(n_cpu);
- long rc = plpar_hcall_norets(H_IPI, hw_cpu, value);
+ long rc;
+
+ /* Make sure all previous accesses are ordered before IPI sending */
+ mb();
+ rc = plpar_hcall_norets(H_IPI, hw_cpu, value);
if (rc != H_SUCCESS) {
pr_err("%s: bad return code qirr cpu=%d hw_cpu=%d mfrr=0x%x "
"returned %ld\n", __func__, n_cpu, hw_cpu, value, rc);
next prev parent reply other threads:[~2012-09-13 0:03 UTC|newest]
Thread overview: 88+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-12 23:35 [ 00/85] 3.4.11-stable review Greg Kroah-Hartman
2012-09-12 23:35 ` [ 01/85] USB: vt6656: remove __devinit* from the struct usb_device_id table Greg Kroah-Hartman
2012-09-12 23:35 ` [ 02/85] USB: emi62: " Greg Kroah-Hartman
2012-09-12 23:35 ` [ 03/85] ALSA: hda - fix Copyright debug message Greg Kroah-Hartman
2012-09-12 23:35 ` [ 04/85] ARM: 7483/1: vfp: only advertise VFPv4 in hwcaps if CONFIG_VFPv3 is enabled Greg Kroah-Hartman
2012-09-12 23:35 ` [ 05/85] ARM: 7487/1: mm: avoid setting nG bit for user mappings that arent present Greg Kroah-Hartman
2012-09-12 23:35 ` [ 06/85] ARM: 7488/1: mm: use 5 bits for swapfile type encoding Greg Kroah-Hartman
2012-09-12 23:35 ` [ 07/85] ARM: 7489/1: errata: fix workaround for erratum #720789 on UP systems Greg Kroah-Hartman
2012-09-12 23:35 ` [ 08/85] ARM: OMAP2+: Fix dmtimer set source clock failure Greg Kroah-Hartman
2012-09-12 23:35 ` [ 09/85] ARM: S3C24XX: Add missing DMACH_DT_PROP Greg Kroah-Hartman
2012-09-12 23:35 ` [ 10/85] ARM: S3C24XX: Fix s3c2410_dma_enqueue parameters Greg Kroah-Hartman
2012-09-12 23:35 ` [ 11/85] Revert dma: imx-dma: Fix kernel crash due to missing clock conversion Greg Kroah-Hartman
2012-09-12 23:35 ` [ 12/85] xen/setup: Fix one-off error when adding for-balloon PFNs to the P2M Greg Kroah-Hartman
2012-09-12 23:35 ` [ 13/85] ARM: imx6: spin the cpu until hardware takes it down Greg Kroah-Hartman
2012-09-12 23:35 ` [ 14/85] ARM: imx: select CPU_FREQ_TABLE when needed Greg Kroah-Hartman
2012-09-12 23:35 ` [ 15/85] ASoC: wm9712: Fix microphone source selection Greg Kroah-Hartman
2012-09-12 23:35 ` [ 16/85] ASoC: omap-mcbsp: Fix 6pin mux configuration Greg Kroah-Hartman
2012-09-12 23:36 ` [ 17/85] vfs: missed source of ->f_pos races Greg Kroah-Hartman
2012-09-12 23:36 ` [ 18/85] vfs: canonicalize create mode in build_open_flags() Greg Kroah-Hartman
2012-09-12 23:36 ` [ 19/85] alpha: fix fpu.h usage in userspace Greg Kroah-Hartman
2012-09-12 23:36 ` [ 20/85] alpha: Dont export SOCK_NONBLOCK to user space Greg Kroah-Hartman
2012-09-12 23:36 ` [ 21/85] USB: winbond: remove __devinit* from the struct usb_device_id table Greg Kroah-Hartman
2012-09-12 23:36 ` [ 22/85] mm: hugetlbfs: correctly populate shared pmd Greg Kroah-Hartman
2012-09-12 23:36 ` [ 23/85] ALSA: hda - dont create dysfunctional mixer controls for ca0132 Greg Kroah-Hartman
2012-09-12 23:36 ` [ 24/85] target: fix NULL pointer dereference bug alloc_page() fails to get memory Greg Kroah-Hartman
2012-09-12 23:36 ` [ 25/85] NFSv3: Ensure that do_proc_get_root() reports errors correctly Greg Kroah-Hartman
2012-09-12 23:36 ` [ 26/85] pnfs: defer release of pages in layoutget Greg Kroah-Hartman
2012-09-12 23:36 ` [ 27/85] NFSv4.1: Remove a bogus BUG_ON() in nfs4_layoutreturn_done Greg Kroah-Hartman
2012-09-12 23:36 ` [ 28/85] NFS: Clear key construction data if the idmap upcall fails Greg Kroah-Hartman
2012-09-12 23:36 ` [ 29/85] NFS: return -ENOKEY when the upcall fails to map the name Greg Kroah-Hartman
2012-09-12 23:36 ` [ 30/85] UBIFS: fix complaints about too small debug buffer size Greg Kroah-Hartman
2012-09-12 23:36 ` [ 31/85] Bluetooth: Fix using NULL inquiry entry Greg Kroah-Hartman
2012-09-12 23:36 ` [ 32/85] Bluetooth: Fix using a NULL inquiry cache entry Greg Kroah-Hartman
2012-09-12 23:36 ` [ 33/85] Bluetooth: Set name_state to unknown when entry name is empty Greg Kroah-Hartman
2012-09-12 23:36 ` [ 34/85] Bluetooth: Fix legacy pairing with some devices Greg Kroah-Hartman
2012-09-12 23:36 ` [ 35/85] NFS: Alias the nfs module to nfs4 Greg Kroah-Hartman
2012-09-12 23:36 ` [ 36/85] audit: dont free_chunk() after fsnotify_add_mark() Greg Kroah-Hartman
2012-09-12 23:36 ` [ 37/85] audit: fix refcounting in audit-tree Greg Kroah-Hartman
2012-09-12 23:36 ` [ 38/85] drm: stop vmgfx driver explosion Greg Kroah-Hartman
2012-09-12 23:36 ` [ 39/85] Revert "drm/radeon: fix bo creation retry path" Greg Kroah-Hartman
2012-09-12 23:36 ` [ 40/85] svcrpc: fix BUG() in svc_tcp_clear_pages Greg Kroah-Hartman
2012-09-12 23:36 ` [ 41/85] svcrpc: fix svc_xprt_enqueue/svc_recv busy-looping Greg Kroah-Hartman
2012-09-12 23:36 ` [ 42/85] svcrpc: sends on closed socket should stop immediately Greg Kroah-Hartman
2012-09-12 23:36 ` [ 43/85] cciss: fix incorrect scsi status reporting Greg Kroah-Hartman
2012-09-12 23:36 ` [ 44/85] ACPI: export symbol acpi_get_table_with_size Greg Kroah-Hartman
2012-09-15 2:19 ` Ben Hutchings
2012-09-12 23:36 ` [ 45/85] ath9k: fix decrypt_error initialization in ath_rx_tasklet() Greg Kroah-Hartman
2012-09-12 23:36 ` [ 46/85] PCI: EHCI: Fix crash during hibernation on ASUS computers Greg Kroah-Hartman
2012-09-12 23:36 ` [ 47/85] block: replace __getblk_slow misfix by grow_dev_page fix Greg Kroah-Hartman
2012-09-12 23:36 ` [ 48/85] sched,cgroup: Fix up task_groups list Greg Kroah-Hartman
2012-09-12 23:36 ` [ 49/85] sched: fix divide by zero at {thread_group,task}_times Greg Kroah-Hartman
2012-09-12 23:36 ` [ 50/85] [media] uvcvideo: Reset the bytesused field when recycling an erroneous buffer Greg Kroah-Hartman
2012-09-12 23:36 ` [ 51/85] rapidio/tsi721: fix inbound doorbell interrupt handling Greg Kroah-Hartman
2012-09-12 23:36 ` [ 52/85] rapidio/tsi721: fix unused variable compiler warning Greg Kroah-Hartman
2012-09-12 23:36 ` [ 53/85] regulator: twl-regulator: fix up VINTANA1/VINTANA2 Greg Kroah-Hartman
2012-09-12 23:36 ` [ 54/85] x32: Use compat shims for {g,s}etsockopt Greg Kroah-Hartman
2012-09-12 23:36 ` [ 55/85] USB: spca506: remove __devinit* from the struct usb_device_id table Greg Kroah-Hartman
2012-09-12 23:36 ` [ 56/85] USB: jl2005bcd: " Greg Kroah-Hartman
2012-09-12 23:36 ` [ 57/85] USB: p54usb: " Greg Kroah-Hartman
2012-09-12 23:36 ` [ 58/85] USB: rtl8187: " Greg Kroah-Hartman
2012-09-12 23:36 ` [ 59/85] USB: smsusb: " Greg Kroah-Hartman
2012-09-12 23:36 ` [ 60/85] USB: CDC ACM: Fix NULL pointer dereference Greg Kroah-Hartman
2012-09-12 23:36 ` [ 61/85] powerpc: Update DSCR on all CPUs when writing sysfs dscr_default Greg Kroah-Hartman
2012-09-12 23:36 ` [ 62/85] powerpc: Keep thread.dscr and thread.dscr_inherit in sync Greg Kroah-Hartman
2012-09-12 23:36 ` [ 63/85] powerpc: Fix DSCR inheritance in copy_thread() Greg Kroah-Hartman
2012-09-12 23:36 ` [ 64/85] powerpc: Restore correct DSCR in context switch Greg Kroah-Hartman
2012-09-12 23:36 ` Greg Kroah-Hartman [this message]
2012-09-12 23:36 ` [ 66/85] Remove user-triggerable BUG from mpol_to_str Greg Kroah-Hartman
2012-09-12 23:36 ` [ 67/85] Fix order of arguments to compat_put_time[spec|val] Greg Kroah-Hartman
2012-09-12 23:36 ` [ 68/85] SCSI: megaraid_sas: Move poll_aen_lock initializer Greg Kroah-Hartman
2012-09-12 23:36 ` [ 69/85] SCSI: scsi_lib: fix scsi_io_completions SG_IO error propagation Greg Kroah-Hartman
2012-09-12 23:36 ` [ 70/85] SCSI: mpt2sas: Fix for Driver oops, when loading driver with max_queue_depth command line option to a very small value Greg Kroah-Hartman
2012-09-12 23:36 ` [ 71/85] SCSI: Fix Device not ready issue on mpt2sas Greg Kroah-Hartman
2012-09-12 23:36 ` [ 72/85] udf: Fix data corruption for files in ICB Greg Kroah-Hartman
2012-09-12 23:36 ` [ 73/85] ext3: Fix fdatasync() for files with only i_size changes Greg Kroah-Hartman
2012-09-12 23:36 ` [ 74/85] fuse: fix retrieve length Greg Kroah-Hartman
2012-09-12 23:36 ` [ 75/85] i2c-designware: Fix build error if CONFIG_I2C_DESIGNWARE_PLATFORM=y && CONFIG_I2C_DESIGNWARE_PCI=y Greg Kroah-Hartman
2012-09-12 23:36 ` [ 76/85] i2c-i801: Add Device IDs for Intel Lynx Point-LP PCH Greg Kroah-Hartman
2012-09-12 23:37 ` [ 77/85] HID: add NOGET quirk for Eaton Ellipse MAX UPS Greg Kroah-Hartman
2012-09-12 23:37 ` [ 78/85] Input: i8042 - add Gigabyte T1005 series netbooks to noloop table Greg Kroah-Hartman
2012-09-12 23:37 ` [ 79/85] drm/vmwgfx: add MODULE_DEVICE_TABLE so vmwgfx loads at boot Greg Kroah-Hartman
2012-09-12 23:37 ` [ 80/85] PARISC: Redefine ATOMIC_INIT and ATOMIC64_INIT to drop the casts Greg Kroah-Hartman
2012-09-12 23:37 ` [ 81/85] xen: Use correct masking in xen_swiotlb_alloc_coherent Greg Kroah-Hartman
2012-09-12 23:37 ` [ 82/85] xen/pciback: Fix proper FLR steps Greg Kroah-Hartman
2012-09-12 23:37 ` [ 83/85] x86, microcode, AMD: Fix broken ucode patch size check Greg Kroah-Hartman
2012-09-12 23:37 ` [ 84/85] dccp: check ccid before dereferencing Greg Kroah-Hartman
2012-09-12 23:37 ` [ 85/85] hwmon: (asus_atk0110) Add quirk for Asus M5A78L Greg Kroah-Hartman
2012-09-12 23:46 ` [ 00/85] 3.4.11-stable review Greg KH
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=20120912233548.543035462@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=benh@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miltonm@bga.com \
--cc=paulus@samba.org \
--cc=stable@vger.kernel.org \
/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.