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 9EE5DC4167B for ; Fri, 9 Dec 2022 06:29:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229463AbiLIG3J (ORCPT ); Fri, 9 Dec 2022 01:29:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229843AbiLIG3E (ORCPT ); Fri, 9 Dec 2022 01:29:04 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DFBE31ECD; Thu, 8 Dec 2022 22:29:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1670567343; x=1702103343; h=date:from:to:cc:subject:message-id:reply-to:references: mime-version:in-reply-to; bh=Tlu8CMGwsT7F5T0zdAfMh3PoUym3LStYGuVUhIigsRU=; b=aQOG6/F969qELkXHXCbi41savMuReoe3Vy4uoM/gqnYAHPOvqG5xFs96 A13SWnBP312KbpEudvbyNrHEri4IxukurScQm0H/nlvBsem0Nn/zvnER1 bjtIYRaoJejDzMpRYzMmHzl4ksw1KKSeXigHYixB3s8+aL/Fbr6D9wX9T FrN20yJwTgOLhOndL++rNmYCkrnWf5U8WEKUm3A5HNQ2ymX3+ck+qFLw3 2//5fFL0ItCLGokCmpacAylsOdeJNVqlkqVh9a4aujdrYjWbZdErl4a9s F4dM0HZ+/1OzV6U2Qza4SZcjiRdNnSnqy1WO4QjbMOzb9uEK5b+BfFeTQ g==; X-IronPort-AV: E=McAfee;i="6500,9779,10555"; a="403646400" X-IronPort-AV: E=Sophos;i="5.96,230,1665471600"; d="scan'208";a="403646400" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2022 22:29:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10555"; a="640921316" X-IronPort-AV: E=Sophos;i="5.96,230,1665471600"; d="scan'208";a="640921316" Received: from chaop.bj.intel.com (HELO localhost) ([10.240.193.75]) by orsmga007.jf.intel.com with ESMTP; 08 Dec 2022 22:28:50 -0800 Date: Fri, 9 Dec 2022 14:24:31 +0800 From: Chao Peng To: Fuad Tabba Cc: 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: <20221209062431.GA1342934@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-api@vger.kernel.org On Tue, Dec 06, 2022 at 03:48:50PM +0000, Fuad Tabba 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. As Yu posted a patch: https://lore.kernel.org/all/20221209023622.274715-1-yu.c.zhang@linux.intel.com/ There is a GPA_INVALID in include/linux/kvm_types.h and I see ARM has already been using it so sounds that is exactly what I need. Chao > > With this fixed, > > Reviewed-by: Fuad Tabba > And the necessary work to port to arm64 (on qemu/arm64): > Tested-by: Fuad Tabba > > Cheers, > /fuad