From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFDBAC352A1 for ; Wed, 7 Dec 2022 15:19:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229736AbiLGPTR (ORCPT ); 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> 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