From: Ben Hutchings <ben@decadent.org.uk>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: akpm@linux-foundation.org, "Borislav Petkov" <bp@alien8.de>,
"Dave Hansen" <dave.hansen@linux.intel.com>,
"H. Peter Anvin" <hpa@zytor.com>,
"Rik van Riel" <riel@redhat.com>,
"Ingo Molnar" <mingo@kernel.org>,
"Peter Zijlstra" <peterz@infradead.org>,
"Andy Lutomirski" <luto@kernel.org>,
"Linus Torvalds" <torvalds@linux-foundation.org>,
"Andy Lutomirski" <luto@amacapital.net>,
"Denys Vlasenko" <dvlasenk@redhat.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Brian Gerst" <brgerst@gmail.com>
Subject: [PATCH 3.2 46/87] x86/mm: Improve switch_mm() barrier comments
Date: Mon, 08 Feb 2016 23:53:51 +0000 [thread overview]
Message-ID: <lsq.1454975631.694644374@decadent.org.uk> (raw)
In-Reply-To: <lsq.1454975630.125133756@decadent.org.uk>
3.2.77-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <luto@kernel.org>
commit 4eaffdd5a5fe6ff9f95e1ab4de1ac904d5e0fa8b upstream.
My previous comments were still a bit confusing and there was a
typo. Fix it up.
Reported-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 71b3c126e611 ("x86/mm: Add barriers and document switch_mm()-vs-flush synchronization")
Link: http://lkml.kernel.org/r/0a0b43cdcdd241c5faaaecfbcc91a155ddedc9a1.1452631609.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
arch/x86/include/asm/mmu_context.h | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
--- a/arch/x86/include/asm/mmu_context.h
+++ b/arch/x86/include/asm/mmu_context.h
@@ -103,14 +103,16 @@ static inline void switch_mm(struct mm_s
* be sent, and CPU 0's TLB will contain a stale entry.)
*
* The bad outcome can occur if either CPU's load is
- * reordered before that CPU's store, so both CPUs much
+ * reordered before that CPU's store, so both CPUs must
* execute full barriers to prevent this from happening.
*
* Thus, switch_mm needs a full barrier between the
* store to mm_cpumask and any operation that could load
- * from next->pgd. This barrier synchronizes with
- * remote TLB flushers. Fortunately, load_cr3 is
- * serializing and thus acts as a full barrier.
+ * from next->pgd. TLB fills are special and can happen
+ * due to instruction fetches or for no reason at all,
+ * and neither LOCK nor MFENCE orders them.
+ * Fortunately, load_cr3() is serializing and gives the
+ * ordering guarantee we need.
*
*/
load_cr3(next->pgd);
@@ -134,9 +136,8 @@ static inline void switch_mm(struct mm_s
* tlb flush IPI delivery. We must reload CR3
* to make sure to use no freed page tables.
*
- * As above, this is a barrier that forces
- * TLB repopulation to be ordered after the
- * store to mm_cpumask.
+ * As above, load_cr3() is serializing and orders TLB
+ * fills with respect to the mm_cpumask write.
*/
load_cr3(next->pgd);
load_mm_ldt(next);
next prev parent reply other threads:[~2016-02-09 0:03 UTC|newest]
Thread overview: 91+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-08 23:53 [PATCH 3.2 00/87] 3.2.77-rc1 review Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 12/87] wlcore: SPI - fix spi transfer_list Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 27/87] rtlwifi: rtl8192ce: Fix handling of module parameters Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 07/87] ath9k_htc: check for underflow in ath9k_htc_rx_msg() Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 30/87] Input: i8042 - add Fujitsu Lifebook U745 to the nomux list Ben Hutchings
2016-02-08 23:53 ` Ben Hutchings [this message]
2016-02-08 23:53 ` [PATCH 3.2 53/87] m32r: fix m32104ut_defconfig build fail Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 33/87] udf: Check output buffer length when converting name to CS0 Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 08/87] mtd: nand: fix ONFI parameter page layout Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 83/87] sctp: Prevent soft lockup when sctp_accept() is called during a timeout event Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 69/87] crypto: af_alg - Disallow bind/setkey/... after accept(2) Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 43/87] ALSA: seq: Fix missing NULL check at remove_events ioctl Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 57/87] ALSA: timer: Harden slave timer list handling Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 79/87] crypto: af_alg - Forbid bind(2) when nokey child sockets are present Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 31/87] x86/xen: don't reset vcpu_info on a cancelled suspend Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 37/87] uml: fix hostfs mknod() Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 87/87] [media] usbvision: fix crash on detecting device with invalid configuration Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 04/87] SCSI: initio: remove duplicate module device table Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 02/87] [media] media: dvb-core: Don't force CAN_INVERSION_AUTO in oneshot mode Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 51/87] cifs: fix race between call_async() and reconnect() Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 84/87] [media] usbvision-video: fix memory leak of alt_max_pkt_size Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 14/87] EDAC: Robustify workqueues destruction Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 61/87] ALSA: hrtimer: Fix stall by hrtimer_cancel() Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 66/87] IB/mlx4: Initialize hop_limit when creating address handle Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 82/87] crypto: algif_skcipher - Load TX SG list after waiting Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 65/87] IB/qib: fix mcast detach when qp not attached Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 64/87] ALSA: control: Avoid kernel warnings from tlv ioctl with numid 0 Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 76/87] crypto: af_alg - Allow af_af_alg_release_parent to be called on nokey path Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 22/87] USB: cp210x: add ID for ELV Marble Sound Board 1 Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 70/87] crypto: af_alg - Add nokey compatibility path Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 55/87] scripts/bloat-o-meter: fix python3 syntax error Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 41/87] x86/boot: Double BOOT_HEAP_SIZE to 64KB Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 39/87] ipv6: tcp: add rcu locking in tcp_v6_send_synack() Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 35/87] locks: fix unlock when fcntl_setlk races with a close Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 73/87] crypto: algif_hash - Require setkey before accept(2) Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 19/87] ALSA: fm801: propagate TUNER_ONLY bit when autodetected Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 36/87] dm snapshot: fix hung bios when copy error occurs Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 23/87] posix-clock: Fix return code on the poll method's error path Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 85/87] [media] usbvision: fix leak of usb_dev on failure paths in usbvision_probe() Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 62/87] ALSA: pcm: Fix snd_pcm_hw_params struct copy in compat mode Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 59/87] printk: help pr_debug and pr_devel to optimize out arguments Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 49/87] sparc64: fix incorrect sign extension in sys_sparc64_personality Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 44/87] ALSA: seq: Fix race at timer setup and close Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 20/87] drm/radeon: clean up fujitsu quirks Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 54/87] dma-debug: switch check from _text to _stext Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 71/87] crypto: algif_skcipher - Add nokey compatibility path Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 03/87] [media] rc: allow rc modules to be loaded if rc-main is not a module Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 67/87] ocfs2: NFS hangs in __ocfs2_cluster_lock due to race with ocfs2_unblock_lock Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 81/87] crypto: algif_skcipher - Fix race condition in skcipher_check_key Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 58/87] memcg: only free spare array when readers are done Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 21/87] udf: limit the maximum number of indirect extents in a row Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 63/87] ALSA: seq: Fix snd_seq_call_port_info_ioctl in compat mode Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 05/87] KVM: x86: expose MSR_TSC_AUX to userspace Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 45/87] parisc: Fix __ARCH_SI_PREAMBLE_SIZE Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 09/87] drm/radeon: call hpd_irq_event on resume Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 25/87] rtlwifi: rtl8192de: Fix incorrect module parameter descriptions Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 50/87] cifs: Ratelimit kernel log messages Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 13/87] wlcore/wl12xx: spi: fix oops on firmware load Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 32/87] udf: Prevent buffer overrun with multi-byte characters Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 52/87] cifs_dbg() outputs an uninitialized buffer in cifs_readdir() Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 86/87] [media] usbvision fix overflow of interfaces array Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 34/87] power: test_power: correctly handle empty writes Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 16/87] powerpc: Make {cmp}xchg* and their atomic_ versions fully ordered Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 26/87] rtlwifi: rtl8192se: Fix module parameter initialization Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 17/87] asix: silence log message from oversize packet Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 56/87] ocfs2/dlm: ignore cleaning the migration mle that is inuse Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 74/87] crypto: skcipher - Add crypto_skcipher_has_setkey Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 72/87] crypto: hash - Add crypto_ahash_has_setkey Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 01/87] [media] gspca: ov534/topro: prevent a division by 0 Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 78/87] crypto: algif_skcipher - Remove custom release parent function Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 48/87] ALSA: timer: Fix race among timer ioctls Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 60/87] crypto: af_alg - Fix socket double-free when accept fails Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 47/87] ALSA: timer: Fix double unlink of active_list Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 18/87] futex: Drop refcount if requeue_pi() acquired the rtmutex Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 40/87] x86/mm: Add barriers and document switch_mm()-vs-flush synchronization Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 77/87] crypto: algif_hash - Remove custom release parent function Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 24/87] x86/LDT: Print the real LDT base address Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 38/87] uml: flush stdout before forking Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 11/87] rtlwifi: fix memory leak for USB device Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 29/87] NFS: Fix attribute cache revalidation Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 06/87] KVM: x86: correctly print #AC in traces Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 10/87] xhci: refuse loading if nousb is used Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 80/87] crypto: algif_hash - Fix race condition in hash_check_key Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 42/87] x86/reboot/quirks: Add iMac10,1 to pci_reboot_dmi_table[] Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 68/87] crypto: algif_skcipher - Require setkey before accept(2) Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 15/87] powerpc: Make value-returning atomics fully ordered Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 28/87] rtlwifi: rtl8192cu: Add missing parameter setup Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 75/87] crypto: algif_skcipher - Add key check exception for cipher_null Ben Hutchings
2016-02-09 0:21 ` [PATCH 3.2 00/87] 3.2.77-rc1 review Ben Hutchings
2016-02-09 3:58 ` Guenter Roeck
2016-02-10 1:00 ` Ben Hutchings
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=lsq.1454975631.694644374@decadent.org.uk \
--to=ben@decadent.org.uk \
--cc=akpm@linux-foundation.org \
--cc=bp@alien8.de \
--cc=brgerst@gmail.com \
--cc=dave.hansen@linux.intel.com \
--cc=dvlasenk@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=riel@redhat.com \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome