Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2242583rwb; Thu, 8 Dec 2022 22:45:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf6i0QxK69MVORkk+uLCqb6FIyx7tlPS4sewQ8CrjYPInr8lcQTzh2vLcn3/OnR4HP/Aafdb X-Received: by 2002:a17:907:20f2:b0:7c1:bb4:ea20 with SMTP id rh18-20020a17090720f200b007c10bb4ea20mr3421980ejb.71.1670568342545; Thu, 08 Dec 2022 22:45:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670568342; cv=none; d=google.com; s=arc-20160816; b=FImiNEjcVL0k2qkuRPDU+LFfrdVgOcmVRdVYNzGdDM9yWJ9zF9knRHeX8sw46nCd19 3ZQl3UzwZpr6lPI/QpDTRNel+oUAgDQNhZ8FfxxjVFuvwx03pjaNS1/OC3Cy/6z9rcX5 ZD6Z6fXalazeBxglDfCPXlwWGJWomRiX4d+3k1bz3FBbf36jYkna438pJ4HxKRDAREZE MODi7wnhyJ1S0VDbbrSR6uY6B3xPdXngE0E3wEyUz0nSWx06qNQTDmlRXaeaUwJK95rs Ijad4ObnQgBa5fwk5xjkZJqKHCwtyIsKZXPotEaljBW+C6wpUKuZtLGf2Z4YFNfHlDch RquA== 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=UDQGjURzpCjyP5tm/3ngkpMvYhuhoMbOM7jc7MXgYoE=; b=sVkbV1F9NIqRxbsZOzwvMHdaoM8mrTbcndwGFVGE7DXSSYCGZtWD4ntM12C8ubrMvh rDtTECOnc4JUIrJogbtfdMqqHm6OvZZmdkYSN/0Ip5cP27nQ3vO9f4M/kX5dyxDYsk81 Ipfy2cgr1RU2N2wuJd8sCu8Bgq+dVV3NeqLD/OnpaEXDtEL4mKrn6Ccxn6bNyJXUFvMe kbyI1ZOIAC9jkz27JHTqe89ZA9TOVFuJYbnJThqcp1WsNGSYdwYGYW1FiibxV0UNUPIT ZqqnVNz2f9xP0rID8Fs+ObTyeqIzrpNbVKX+gMPrXQZBqKr7VA9FdQ35GUqLKETrygeN yh2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="aQOG6/F9"; 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 gn18-20020a1709070d1200b007c0a8b58276si617609ejc.773.2022.12.08.22.45.24; Thu, 08 Dec 2022 22:45:42 -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="aQOG6/F9"; 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 S229683AbiLIG3K (ORCPT + 73 others); Fri, 9 Dec 2022 01:29:10 -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: X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 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