From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753285AbdK1BWI (ORCPT ); Mon, 27 Nov 2017 20:22:08 -0500 Received: from mga04.intel.com ([192.55.52.120]:12912 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752712AbdK1BWF (ORCPT ); Mon, 27 Nov 2017 20:22:05 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,466,1505804400"; d="scan'208";a="178513839" Subject: Re: 2f47e7e19f ("x86/mm/kaiser: Use PCID feature to make user and .."): WARNING: CPU: 0 PID: 1 at mm/early_ioremap.c:114 __early_ioremap To: "Rafael J. Wysocki" References: <5a1aaa36.CWNgvwmmRFzeAlPc%fengguang.wu@intel.com> <20171127101814.jsglrh7typy3pxxp@gmail.com> Cc: Ingo Molnar , kernel test robot , LKP , kvm@vger.kernel.org, Linux Kernel Mailing List , Thomas Gleixner , wfg@linux.intel.com, "Rafael J. Wysocki" , ACPI Devel Maling List , "Brown, Len" , Jesse Barnes , Bjorn Helgaas From: Dave Hansen Message-ID: <9f73a515-ce07-c833-4e6b-2062fe03f354@linux.intel.com> Date: Mon, 27 Nov 2017 17:22:02 -0800 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 I think I narrowed this down. __native_flush_tlb_single() depends on cpu_tlbstate.loaded_mm_asid matching what is in CR3. But, while we are still "early" in boot, CR3 has hardware ASID=0, but cpu_tlbstate.loaded_mm_asid=0 which is actually hardware ASID=1. So, we have ASID=0 in CR3 and we try to *flush* ASID=1 with INVPCID, which does nothing for us, effectively missing the TLB flush. I think we need to steer __native_flush_tlb_single() into the "!this_cpu_has(X86_FEATURE_INVPCID_SINGLE)" path if we get called before initialize_tlbstate_and_flush() gives us a "real" ASID in CR3, but I haven't found a nice way to do it, yet. We probably also need a debugging warning in there to read CR3 and check it against cpu_tlbstate.loaded_mm_asid. I'll look at this in some more detail tomorrow if nobody beats me to it.