Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1026523rwb; Wed, 7 Dec 2022 07:49:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf7O+I5AGXC4g6mOnOsfLQdJFhu7SePf7FB2xi6ef22RuM+Ua+pzdnd8nR5XD2acG2sq2Zno X-Received: by 2002:a17:906:2e9a:b0:7c0:f911:28b3 with SMTP id o26-20020a1709062e9a00b007c0f91128b3mr2544697eji.303.1670428141705; Wed, 07 Dec 2022 07:49:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670428141; cv=none; d=google.com; s=arc-20160816; b=QXmPMVWf5iPWnutT5AKi1QicaM3PbZ3cdGyHw+7MrjfscWfh7gVwVC095A9a4nafxh nkv7qT65xAmZHWFz6kaX7c9itwX/3ttOvH9DXDuk5gErVQgOg32N4xb5WLpDURWnDZhH ResUU/f7Anf7GQFnf74GoXtttcTYk++3FBfuRgh/4b31H/mnTC2nOB58Uqf59Wm9yFyo vjqzdrHnlE24cDRafeIaMgRu58l8NccQZCRaBeeherpXHT/j9/eS0e844581QzxJruNa Dq2OqcJaXdYWSycIOXu4T2IfdEsTjnjr1gaB4CQq4RInfdCkSDLmLff/+3GJMhxN0uBh ydVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=mNFmn9tV1wS1dhLKrTRMxzFcEnRphcHuzHYZmp+kJN4=; b=KIt8FmqvpL1yOTNGYGFdkv7+uz/r52SjSxl3IPIQ5VsyjFABpYCN9aoY8wy1fLZ+f3 3Nhv7hc+TTC/IFnZI9HQ+EqWIq/CjEEkqNQfQKeaZV7iSnwG9DQeIBM9AxknFZjp5iwN utP+Bsr1mDZj4Oz/aedPyFFo4zKCMM7krxx/pCSaoq2HoX3GBzDWsp9nFskW9TLomg0s uAqYzar8VKJMYPQ40khl7krhDe8y+3WdUsa/i4BRCrN6V2yBS+t5OZVgMZcFAn5cUzzR rTpxUiqU6TNrcSMFt6V2dVZOdmKb/OcW5aWJDP4sAUhjy19FuLkekR6Gt5UutSGgne80 u3oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Bd80++yc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hg4-20020a1709072cc400b007bfdadb58d8si17787702ejc.544.2022.12.07.07.48.43; Wed, 07 Dec 2022 07:49:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Bd80++yc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229714AbiLGPTR (ORCPT + 76 others); Wed, 7 Dec 2022 10:19:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229497AbiLGPTJ (ORCPT ); Wed, 7 Dec 2022 10:19:09 -0500 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75EDB1E3DC; Wed, 7 Dec 2022 07:19:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1670426348; x=1701962348; h=date:from:to:cc:subject:message-id:reply-to:references: mime-version:in-reply-to; bh=jSuyaBC+CEdahrEMqj1EGdbe+9W/yLc3hrTCB1EDaSs=; b=Bd80++yc/u9Sg9fSdqD2reRXYGDX/dr1JBIJXODlt77ytFxYU7hE9LfB LS9x5t4esauEUdO+pspid+oZN4uTk4452zf8qG/ZIXz7/w5+CWKaCa/a6 FJNEeIXNOc3pSTdjFEMaH8i7IQdJtDQR2zvVRaSKPi3QpBcFB7CG+uQeR Af7VFB0GGdq8j1qj7CfmYU9r73CGJMktD9Hdabaqkod2Tupx0ElPawjeG yOurzxfawV6drBDeGANKtUzxPOQsiEGsVN42qk3YxP1WUwMo50mDj8uPv j62KYmciTP4Cphsehjv4yMQKtisUwgTJF4IOE+yzvAQhCEhbZxjNIOC2u A==; X-IronPort-AV: E=McAfee;i="6500,9779,10553"; a="343948387" X-IronPort-AV: E=Sophos;i="5.96,225,1665471600"; d="scan'208";a="343948387" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Dec 2022 07:19:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10553"; a="710096874" X-IronPort-AV: E=Sophos;i="5.96,225,1665471600"; d="scan'208";a="710096874" Received: from chaop.bj.intel.com (HELO localhost) ([10.240.193.75]) by fmsmga008.fm.intel.com with ESMTP; 07 Dec 2022 07:18:57 -0800 Date: Wed, 7 Dec 2022 23:14:37 +0800 From: Chao Peng To: Isaku Yamahata Cc: Fuad Tabba , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, linux-doc@vger.kernel.org, qemu-devel@nongnu.org, Paolo Bonzini , Jonathan Corbet , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Arnd Bergmann , Naoya Horiguchi , Miaohe Lin , x86@kernel.org, "H . Peter Anvin" , Hugh Dickins , Jeff Layton , "J . Bruce Fields" , Andrew Morton , Shuah Khan , Mike Rapoport , Steven Price , "Maciej S . Szmigiero" , Vlastimil Babka , Vishal Annapurve , Yu Zhang , "Kirill A . Shutemov" , luto@kernel.org, jun.nakajima@intel.com, dave.hansen@intel.com, ak@linux.intel.com, david@redhat.com, aarcange@redhat.com, ddutile@redhat.com, dhildenb@redhat.com, Quentin Perret , Michael Roth , mhocko@suse.com, wei.w.wang@intel.com Subject: Re: [PATCH v10 5/9] KVM: Use gfn instead of hva for mmu_notifier_retry Message-ID: <20221207151437.GF1275553@chaop.bj.intel.com> Reply-To: Chao Peng References: <20221202061347.1070246-1-chao.p.peng@linux.intel.com> <20221202061347.1070246-6-chao.p.peng@linux.intel.com> <20221206115623.GB1216605@chaop.bj.intel.com> <20221207063411.GB3632095@ls.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221207063411.GB3632095@ls.amr.corp.intel.com> X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 06, 2022 at 10:34:11PM -0800, Isaku Yamahata wrote: > On Tue, Dec 06, 2022 at 07:56:23PM +0800, > Chao Peng wrote: > > > > > - if (unlikely(kvm->mmu_invalidate_in_progress) && > > > > - hva >= kvm->mmu_invalidate_range_start && > > > > - hva < kvm->mmu_invalidate_range_end) > > > > - return 1; > > > > + if (unlikely(kvm->mmu_invalidate_in_progress)) { > > > > + /* > > > > + * Dropping mmu_lock after bumping mmu_invalidate_in_progress > > > > + * but before updating the range is a KVM bug. > > > > + */ > > > > + if (WARN_ON_ONCE(kvm->mmu_invalidate_range_start == INVALID_GPA || > > > > + kvm->mmu_invalidate_range_end == INVALID_GPA)) > > > > > > INVALID_GPA is an x86-specific define in > > > arch/x86/include/asm/kvm_host.h, so this doesn't build on other > > > architectures. The obvious fix is to move it to > > > include/linux/kvm_host.h. > > > > Hmm, INVALID_GPA is defined as ZERO for x86, not 100% confident this is > > correct choice for other architectures, but after search it has not been > > used for other architectures, so should be safe to make it common. > > INVALID_GPA is defined as all bit 1. Please notice "~" (tilde). > > #define INVALID_GPA (~(gpa_t)0) Thanks for mention. Still looks right moving it to include/linux/kvm_host.h. Chao > -- > Isaku Yamahata