From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933591AbdKAWYH (ORCPT ); Wed, 1 Nov 2017 18:24:07 -0400 Received: from mga14.intel.com ([192.55.52.115]:2999 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933336AbdKAWYG (ORCPT ); Wed, 1 Nov 2017 18:24:06 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,331,1505804400"; d="scan'208";a="144844430" Subject: Re: [PATCH 04/23] x86, tlb: make CR4-based TLB flushes more robust To: Thomas Gleixner References: <20171031223146.6B47C861@viggo.jf.intel.com> <20171031223154.67F15B2A@viggo.jf.intel.com> Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, moritz.lipp@iaik.tugraz.at, daniel.gruss@iaik.tugraz.at, michael.schwarz@iaik.tugraz.at, luto@kernel.org, torvalds@linux-foundation.org, keescook@google.com, hughd@google.com, x86@kernel.org From: Dave Hansen Message-ID: Date: Wed, 1 Nov 2017 15:24:03 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/01/2017 02:25 PM, Thomas Gleixner wrote: >> cr4 = this_cpu_read(cpu_tlbstate.cr4); >> - /* clear PGE */ >> - native_write_cr4(cr4 & ~X86_CR4_PGE); >> - /* write old PGE again and flush TLBs */ >> + /* >> + * This function is only called on systems that support X86_CR4_PGE >> + * and where always set X86_CR4_PGE. Warn if we are called without >> + * PGE set. >> + */ >> + WARN_ON_ONCE(!(cr4 & X86_CR4_PGE)); > Because if CR4_PGE is not set, this warning triggers. So this defeats the > toggle mode you are implementing. The warning is there because there is probably plenty of *other* stuff that breaks if we have X86_FEATURE_PGE=1, but CR4.PGE=0. The point of this was to make this function do the right thing no matter what, but warn if it gets called in an unexpected way.