Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966321AbdLSClP (ORCPT ); Mon, 18 Dec 2017 21:41:15 -0500 Received: from mga06.intel.com ([134.134.136.31]:3571 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964828AbdLSClN (ORCPT ); Mon, 18 Dec 2017 21:41:13 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,424,1508828400"; d="scan'208";a="3621930" Date: Tue, 19 Dec 2017 10:40:53 +0800 From: Haozhong Zhang To: Paolo Bonzini Cc: kvm@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, rkrcmar@redhat.com, Xiao Guangrong , Dan Williams , ivan.d.cuevas.escareno@intel.com, karthik.kumar@intel.com, Konrad Rzeszutek Wilk , Olif Chapman , Mikulas Patocka , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Borislav Petkov , Tom Lendacky Subject: Re: [PATCH v5 1/2] x86/mm: add a function to check if a pfn is UC/UC- Message-ID: <20171219024053.b5ckuwevnm2ydzef@hz-desktop> Mail-Followup-To: Paolo Bonzini , kvm@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, rkrcmar@redhat.com, Xiao Guangrong , Dan Williams , ivan.d.cuevas.escareno@intel.com, karthik.kumar@intel.com, Konrad Rzeszutek Wilk , Olif Chapman , Mikulas Patocka , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Borislav Petkov , Tom Lendacky References: <20171108075630.16991-1-haozhong.zhang@intel.com> <20171108075630.16991-2-haozhong.zhang@intel.com> <2da7d38c-8135-a722-8d93-f3d1a618b12e@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2da7d38c-8135-a722-8d93-f3d1a618b12e@redhat.com> User-Agent: NeoMutt/20171027 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 743 Lines: 20 On 12/18/17 13:55 +0100, Paolo Bonzini wrote: > On 08/11/2017 08:56, Haozhong Zhang wrote: > > +bool pat_pfn_is_uc_or_uc_minus(unsigned long pfn) > > +{ > > + enum page_cache_mode cm = lookup_memtype(PFN_PHYS(pfn)); > > + > > + return cm == _PAGE_CACHE_MODE_UC || cm == _PAGE_CACHE_MODE_UC_MINUS; > > +} > > +EXPORT_SYMBOL_GPL(pat_pfn_is_uc_or_uc_minus); > > + > > As discussed in the reply to v2, this should include WC too. The > function name could become something like pat_pfn_downgraded_by_uc_mtrr. Or shall we just expose lookup_memtype(), and keep all other logic in KVM? The function name still looks strange somehow, and the check of memory type makes more sense and would be easier to understand in the context of KVM. Haozhong