Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp10056982rwp; Thu, 20 Jul 2023 14:00:00 -0700 (PDT) X-Google-Smtp-Source: APBJJlGDR/BkeCzRe/xI09tGG6nQo6sApeiOM1aQ1GxCMx4+AlRV8uda0mBkc4NNsXruLEZOi1EB X-Received: by 2002:a05:6a20:948c:b0:129:d944:2e65 with SMTP id hs12-20020a056a20948c00b00129d9442e65mr49069pzb.13.1689886800273; Thu, 20 Jul 2023 14:00:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689886800; cv=none; d=google.com; s=arc-20160816; b=TwJYVPEiFzNIWY9ZfjzQkPNFFV1hXWFXjxKUVJ+IkMv+nSK7mRKp6U9WOWUmc96tJ+ p0FN2m9n9lySJPPTaSEjqc81S/TWUpJV3wHYrmevvvpROz6dTe5Cqz1em0amtjeBjEk6 /K7LIDjHTGs6uCqiAms7rMMp2s0N9ySYWKt0AGTugSU9C+IQ6Vz/vxNdP76EBLKZbeLl +5x0dghOyaX2GadIRR35p4M6xaN4lBz0qPOz3rv5E7GhplcxYctHlSchRaQNYSlPsUT6 YZOy5R96CX6RlNUe+hFUS7m2pen1TG1zBKZi64AICQjebxqbAzQOJC8op+QwN4vGxr6D lMNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=s1/m4T5EZ9UQZdIAs+CFQOUhGGMJn3z6NAlZtvxtssM=; fh=p/kildOQIemnNt3RNPuRRv2OSAlpqz/uQBqDbn6calQ=; b=R8TG9buK2bZ5cHZwesfcGsk/4RGKU+io6oV7Ts24oHI7zXvgprbiRNQQhI2r7+vU/k 6arXbts8b6WHyEc9NElNvFlx+j6GY1hrxzLdT3nJ7Tom0MIgchshYkwvDQQsM+55TCFq 9TQP+G8Wpo9z6fdGIrIlRuO6c6DW27/J5imbd0IBm60tw1DyICCCqhONuu0y/VJgeOzw qv0HVyiC7Cpjo4+YPhr8ZDL90EuxCMHZaT+JasIGhaYm+W0BBSssjEiiPSyuhNIbY2G9 0qvEVQQp21HNz+oleVRZ2WuGCy/daPo6zpiL0vsEK0zpPzFNMB3unpoLFcYNCpt6y7Qc jlBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=mbsHztlE; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bk13-20020a056a02028d00b005600a533c7esi1495076pgb.89.2023.07.20.13.59.47; Thu, 20 Jul 2023 14:00:00 -0700 (PDT) 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=@google.com header.s=20221208 header.b=mbsHztlE; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229897AbjGTUUU (ORCPT + 99 others); Thu, 20 Jul 2023 16:20:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229638AbjGTUUP (ORCPT ); Thu, 20 Jul 2023 16:20:15 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54086271D for ; Thu, 20 Jul 2023 13:20:14 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-c6db61f7f64so1041029276.0 for ; Thu, 20 Jul 2023 13:20:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689884413; x=1690489213; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=s1/m4T5EZ9UQZdIAs+CFQOUhGGMJn3z6NAlZtvxtssM=; b=mbsHztlENnOTDgeCIXRdF8x4x9OfLSlTRQf7EJhk2yHC8ssudjPjJb663muGwwAUde HXusCSecX8QAy71He4xwRicW2VAZ7RFVOVmJQZun5eygpfocaFcEhJVdz1DXPqrP14f5 Q9r/63tqP/iMmto5FytBtXhV7bicbpwNBGhhzc7AVroN6uvn7SvVpiEQCLnIHWcphWhi L6PAVpT/JWEQDmjGRRbXmNFkgwEJImoyKV1xDjpLesAAmXECVa9yb/PUNJmSrVHElsLh RUk/Cxj/0yokxjf+pISM5EmdcaPLl3odQz7EeG720kJEtO6hviZvCg7ubhY+cpI9tJBr NkXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689884413; x=1690489213; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=s1/m4T5EZ9UQZdIAs+CFQOUhGGMJn3z6NAlZtvxtssM=; b=C0xiRlVCEkPLw19vyr1qWVzdPUoCpbOEpmytt6GpzQL91fIEUIkrxxnf4NFpPv4cDY eo9NZOZUYr0qR7xBdD9M+YahnmxqUcy6N/ULREMeoAYl1JDFWQM9h1+PqTqWkc/RiiYT tr5B0/6UVbCKCU+yYfEM0HzAwfX8lZkwscrlt9V/2ntx9csC9JAxjq+kevoLasPSvyH1 uWOXBin64IGvh2Jb/tJ15P607fCD2mZSoOCCtbvt0LcdBtQ7jebS43eFcv9JzXhyECJq mKnxZ4wyiZLNtjzE8ZzKwRSKwmAoS3vHqbO7semEm3ByjxdYBERm8yApKuvSDpUpo2ux WezQ== X-Gm-Message-State: ABy/qLbw6Qb/nOJ3PYaXHNnJ8BTQq8XFogps+RIg+tjAmH7q9+DfhrWn BS+kJ3i7MeJazsgoU3pR+oZ6A++HqX0= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a25:4d08:0:b0:c6c:6122:5b69 with SMTP id a8-20020a254d08000000b00c6c61225b69mr236ybb.8.1689884413509; Thu, 20 Jul 2023 13:20:13 -0700 (PDT) Date: Thu, 20 Jul 2023 13:20:11 -0700 In-Reply-To: <20230720190211.GF25699@ls.amr.corp.intel.com> Mime-Version: 1.0 References: <20230718234512.1690985-1-seanjc@google.com> <20230718234512.1690985-9-seanjc@google.com> <20230720080912.g56zi5hywazrhnam@yy-desk-7060> <20230720190211.GF25699@ls.amr.corp.intel.com> Message-ID: Subject: Re: [RFC PATCH v11 08/29] KVM: Introduce per-page memory attributes From: Sean Christopherson To: Isaku Yamahata Cc: Yuan Yao , Paolo Bonzini , Marc Zyngier , Oliver Upton , Huacai Chen , Michael Ellerman , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , "Matthew Wilcox (Oracle)" , Andrew Morton , Paul Moore , James Morris , "Serge E. Hallyn" , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Chao Peng , Fuad Tabba , Jarkko Sakkinen , Yu Zhang , Vishal Annapurve , Ackerley Tng , Maciej Szmigiero , Vlastimil Babka , David Hildenbrand , Quentin Perret , Michael Roth , Wang , Liam Merwick , "Kirill A . Shutemov" Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL 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 Thu, Jul 20, 2023, Isaku Yamahata wrote: > On Thu, Jul 20, 2023 at 04:09:12PM +0800, > Yuan Yao wrote: > > > On Tue, Jul 18, 2023 at 04:44:51PM -0700, Sean Christopherson wrote: > > > @@ -2301,4 +2305,14 @@ static inline void kvm_account_pgtable_pages(void *virt, int nr) > > > /* Max number of entries allowed for each kvm dirty ring */ > > > #define KVM_DIRTY_RING_MAX_ENTRIES 65536 > > > > > > +#ifdef CONFIG_KVM_GENERIC_MEMORY_ATTRIBUTES > > > +static inline unsigned long kvm_get_memory_attributes(struct kvm *kvm, gfn_t gfn) > > > +{ > > > + return xa_to_value(xa_load(&kvm->mem_attr_array, gfn)); > > > +} > > > + > > > +bool kvm_arch_post_set_memory_attributes(struct kvm *kvm, > > > + struct kvm_gfn_range *range); > > > > Used but no definition in this patch, it's defined in next patch 09. > > How about add weak version in this patch and let ARCHs to overide it ? > > It is guarded by CONFIG_KVM_GENERIC_MEMORY_ATTRIBUTES. Yep. I don't love the ordering, e.g. this patch can't even be compile tested until later in the series, but I wanted to separate x86 usage from the generic support code.