Received: by 10.223.164.202 with SMTP id h10csp3230321wrb; Sat, 25 Nov 2017 04:40:51 -0800 (PST) X-Google-Smtp-Source: AGs4zMbH2ShbkyciB7QUNsRaZBtVfA7Z7NHKmIyPD9914Zc1NVpnv6Z8VAxsYoZDylOrNwK1aMy+ X-Received: by 10.98.38.66 with SMTP id m63mr20934927pfm.0.1511613650890; Sat, 25 Nov 2017 04:40:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511613650; cv=none; d=google.com; s=arc-20160816; b=BRk2+CIM5bH27sw2fs5TyujcFIbdFnxSD3AQzfL2pHoC2rrAZQYzE79LYM0SXyR8xb NOX9Vb9mtGPVcl5q1EhZ+MW6AMnhp3BCbcse7NYzqLSu2uZ3QotzFKXVYZrDq+5Gq0WE VJ5soNz4jf1rlw3WJLIc4hqF05ZtUWoy3fLF1yoZc130+ltSdl2/Uz2iqAhmBNaZYF12 XL+iukF/sahQpXOdi4QwE239E+qoC2xpqyvNEqoKQ5CnE1BdqKVUWzWIwjdqd2xaEImg YC9kRYwnaelfdJy+Pl6RC8C5Cuj9Y4256TUakJv0BAgTC0r5LfKQNfBxKI76KYf/ijqX FbGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=/rT3hpHxpuI34WhlH/0e53SbDjD2mXHMXZ0G3m+Ab3g=; b=qaTGD12EWLAwbio/qSJoh5U9ps0JkmH4MSES6OUXwmIhIlTskzwZKggAZqkESlk48v X+Lfno87InV9Jol0Go2CL+QAUHGcz2h/x5gZqCmYMcxyEu6Dhe/HxWFGk/ipBEOZqbVi t4lYTJ5ZOrpTqyierd//lqCFqiHHbCugR3gyHZVd+90wGAyxNglmYQo27BrZoJQ3afto Yaxp4LGQgWfvqz/yULwebMOw+H7GbGXPyY6JQpxO4n4fUFNqNfgme0QyQ2SlEaGuJSAH VlVary5tUWPUkQV/a/Yp12fQwnKfUBnjVtEz5mfpyuNlKPusrdf7xtydx5PLCEzDAimZ aGQA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t69si13913503pfa.77.2017.11.25.04.40.38; Sat, 25 Nov 2017 04:40:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751611AbdKYMiy (ORCPT + 79 others); Sat, 25 Nov 2017 07:38:54 -0500 Received: from terminus.zytor.com ([65.50.211.136]:37829 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751524AbdKYMiw (ORCPT ); Sat, 25 Nov 2017 07:38:52 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id vAPCbiSx002759; Sat, 25 Nov 2017 04:37:44 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id vAPCbhMD002754; Sat, 25 Nov 2017 04:37:43 -0800 Date: Sat, 25 Nov 2017 04:37:43 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Nadav Amit Message-ID: Cc: tglx@linutronix.de, mingo@kernel.org, luto@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org, namit@vmware.com Reply-To: mingo@kernel.org, tglx@linutronix.de, hpa@zytor.com, luto@kernel.org, linux-kernel@vger.kernel.org, namit@vmware.com In-Reply-To: <20171125032907.2241-2-namit@vmware.com> References: <20171125032907.2241-2-namit@vmware.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] x86/tlb: Refactor CR4 setting and shadow write Git-Commit-ID: 0c3292ca8025c5aef44dc389ac3a6bf4a325e0be X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 0c3292ca8025c5aef44dc389ac3a6bf4a325e0be Gitweb: https://git.kernel.org/tip/0c3292ca8025c5aef44dc389ac3a6bf4a325e0be Author: Nadav Amit AuthorDate: Fri, 24 Nov 2017 19:29:06 -0800 Committer: Thomas Gleixner CommitDate: Sat, 25 Nov 2017 13:28:43 +0100 x86/tlb: Refactor CR4 setting and shadow write Refactor the write to CR4 and its shadow value. This is done in preparation for the addition of an assertion to check that IRQs are disabled during CR4 update. No functional change. Signed-off-by: Nadav Amit Signed-off-by: Thomas Gleixner Cc: nadav.amit@gmail.com Cc: Andy Lutomirski Cc: linux-edac@vger.kernel.org Link: https://lkml.kernel.org/r/20171125032907.2241-2-namit@vmware.com --- arch/x86/include/asm/tlbflush.h | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h index 509046c..e736f7f 100644 --- a/arch/x86/include/asm/tlbflush.h +++ b/arch/x86/include/asm/tlbflush.h @@ -173,17 +173,20 @@ static inline void cr4_init_shadow(void) this_cpu_write(cpu_tlbstate.cr4, __read_cr4()); } +static inline void __cr4_set(unsigned long cr4) +{ + this_cpu_write(cpu_tlbstate.cr4, cr4); + __write_cr4(cr4); +} + /* Set in this cpu's CR4. */ static inline void cr4_set_bits(unsigned long mask) { unsigned long cr4; cr4 = this_cpu_read(cpu_tlbstate.cr4); - if ((cr4 | mask) != cr4) { - cr4 |= mask; - this_cpu_write(cpu_tlbstate.cr4, cr4); - __write_cr4(cr4); - } + if ((cr4 | mask) != cr4) + __cr4_set(cr4 | mask); } /* Clear in this cpu's CR4. */ @@ -192,11 +195,8 @@ static inline void cr4_clear_bits(unsigned long mask) unsigned long cr4; cr4 = this_cpu_read(cpu_tlbstate.cr4); - if ((cr4 & ~mask) != cr4) { - cr4 &= ~mask; - this_cpu_write(cpu_tlbstate.cr4, cr4); - __write_cr4(cr4); - } + if ((cr4 & ~mask) != cr4) + __cr4_set(cr4 & ~mask); } static inline void cr4_toggle_bits(unsigned long mask) @@ -204,9 +204,7 @@ static inline void cr4_toggle_bits(unsigned long mask) unsigned long cr4; cr4 = this_cpu_read(cpu_tlbstate.cr4); - cr4 ^= mask; - this_cpu_write(cpu_tlbstate.cr4, cr4); - __write_cr4(cr4); + __cr4_set(cr4 ^ mask); } /* Read the CR4 shadow. */ From 1585846516232337389@xxx Mon Dec 04 09:51:32 +0000 2017 X-GM-THRID: 1585405315274713781 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread