Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp615774rdb; Sat, 19 Aug 2023 16:19:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGpDa2BLJLNFt/uNkfcRg+VXuw5f7bSutLqtvRUZPtmabMVEutXemQIWeRlnrPSDKqTM9x/ X-Received: by 2002:a05:6a20:6a05:b0:140:cb66:73aa with SMTP id p5-20020a056a206a0500b00140cb6673aamr4306601pzk.3.1692487146895; Sat, 19 Aug 2023 16:19:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692487146; cv=none; d=google.com; s=arc-20160816; b=vpjTrNZphfB90rdwGiwWj+v5OPdlxjyYMWHp++1Kp6I8ML7JeiDzrXRTDp5xcnyf/9 txsTbggswk0uh2kba+x16oprzzMcjW3nWXDEfcrEMFR+EntJ8nWlE18W2Glc8KAHwYE8 mgagZIR3O9LC7btP3BqyyDMD46GTeMnz8CebFAkMMV/nmThtkUd0Q7Fv6u6KStT/Wo25 WRz5tDwrEOita+4k8e6TGhHRapHIdwpqAn6gQMn3WIBKWpBPxmXZ3Xe0nhggbohvARix v7NeduKtzgwB91W5uaUA5xJrOr2wHa4eFAIIlyOlCH2/8ZxgFC4efxY2tBNBhaLTX/0P C0Og== 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=WLV8cwl+q0+MgeCaKnjEbSXBm+ijn/cuT9eg2QvMQy8=; fh=UgEXn3mRZ7D8AovH/EGBHUrp4a0WP4p9OntPur98yWs=; b=WWqVafrgGQIezv4Gx5WlwCOP58G1Ya+P5Q3sCBPiGs1iugMIoQRqHp8RUA76XsMQEt YdHlesL2CiCo0B/cuCYK5XPOF0YtL37N+iQ/mPh4n0yDQfxaDxx1hqsCI1WdNRCTCKu6 4CHWo9TQEEOLIckEY2rLffgLpYV7YwQAPU5rw7BgWo6TUF+Q7NsGA7UC/9/YvRt7lOtE vF52qNdaiIC0dTQD78S6oT287Jq4oRQR+mx1D1o3lW/6ElNz2dpNuDaSdLu87hqF09Wy PJgPNxveC9tSUlFoSFNLsgpacxw1EuuIpEJv8ltLeiwzvpl7lmqbFCZXw0aA7VTSYRck fnwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b="WyQ6Tn/5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id v202-20020a6361d3000000b00565f611a1ffsi4035385pgb.252.2023.08.19.16.19.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Aug 2023 16:19:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b="WyQ6Tn/5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 34CA169BC3; Sat, 19 Aug 2023 11:04:10 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233131AbjHNVzU (ORCPT + 99 others); Mon, 14 Aug 2023 17:55:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233220AbjHNVzH (ORCPT ); Mon, 14 Aug 2023 17:55:07 -0400 Received: from mail-pg1-x54a.google.com (mail-pg1-x54a.google.com [IPv6:2607:f8b0:4864:20::54a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE4501BC0 for ; Mon, 14 Aug 2023 14:54:38 -0700 (PDT) Received: by mail-pg1-x54a.google.com with SMTP id 41be03b00d2f7-564b8c528f7so8926179a12.2 for ; Mon, 14 Aug 2023 14:54:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1692050074; x=1692654874; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=WLV8cwl+q0+MgeCaKnjEbSXBm+ijn/cuT9eg2QvMQy8=; b=WyQ6Tn/5h37xMsEIDmbWcY+nQiTqqFoftlXVBTiztMb2A7vinkou0FyJxT5Tj+pa31 3y4mktmY47itqZcGsKCOeUubQi9MQwPyYS/ntrx9oV/jIdUAoZkwRuGY0yw403B+hUV5 PyUzYrySs29/O30p+yDsELGRzby+1aqFcxoBBJ6omQFPygNitIVTJAp2Hnd4R0/QcY2H EgizfgVBfhm/BlB4owWFjSnqlPuhKRjVS+MvDjPpwOsN8USa7haRJjhrCn+/9m5M/b9b HnVauoeuLnwYhNy2SBnjlv/xkJdMMlVKqHESswng1uUarqPNC4oB5B1VogZQC9cpA3Kv gLzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692050074; x=1692654874; 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=WLV8cwl+q0+MgeCaKnjEbSXBm+ijn/cuT9eg2QvMQy8=; b=kGWlT/W+8onkSUsupsSl9amyAkkyhiaKKgngv6eKhWApQs4XMFHD3SZpkVMIdzK68H fTojU0NuM0GmgB6m8EMZKxZk1De2KY1tx8gJO2FkW6P77lh8mib3K8D6m/Vq0disk3fx gF9KjuCkd0tyCSIGHhVmFtchQVks82bzc2Wk1LzXUJ0J8RiO0oH+kyLlynmbwYGaN1pI xGL3Up0CHGSiBsaLYMyO9poDCUtmF5tIS9rWOdEsJXh58nbiM5neBhhehgtdPoOpUDn3 b8NRIxQZzfY66AtvqKozMZyvcU6Hct5Q3pqRs+Ctq9G1K2EoZ3u+XHZdEZB+mgK5LmD6 lTZA== X-Gm-Message-State: AOJu0YzJnFrDBzcAUguceTnLH6k21lZ/MerwBJGYfybBOESzM3o+K9Fo pGke6GhOiXTsaXgb2eID+1AgVwEd3To= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a63:9f12:0:b0:565:3355:87b0 with SMTP id g18-20020a639f12000000b00565335587b0mr2044577pge.5.1692050074189; Mon, 14 Aug 2023 14:54:34 -0700 (PDT) Date: Mon, 14 Aug 2023 14:54:32 -0700 In-Reply-To: <02239d95-0253-a223-28c2-016cca3ab4d2@linux.intel.com> Mime-Version: 1.0 References: <20230718234512.1690985-1-seanjc@google.com> <20230718234512.1690985-9-seanjc@google.com> <02239d95-0253-a223-28c2-016cca3ab4d2@linux.intel.com> Message-ID: Subject: Re: [RFC PATCH v11 08/29] KVM: Introduce per-page memory attributes From: Sean Christopherson To: Binbin Wu Cc: Chao Peng , 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, Fuad Tabba , Jarkko Sakkinen , Yu Zhang , Vishal Annapurve , Ackerley Tng , Maciej Szmigiero , Vlastimil Babka , David Hildenbrand , Quentin Perret , Michael Roth , Wang , Liam Merwick , Isaku Yamahata , "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,USER_IN_DEF_DKIM_WL autolearn=unavailable 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 Mon, Aug 14, 2023, Binbin Wu wrote: > > On 7/19/2023 7:44 AM, Sean Christopherson wrote: > > + struct kvm_mmu_notifier_range post_set_range = { > > + .start = start, > > + .end = end, > > + .arg.attributes = attributes, > > + .handler = kvm_arch_post_set_memory_attributes, > > + .on_lock = (void *)kvm_null_fn, > > + .on_unlock = kvm_mmu_invalidate_end, > > + .may_block = true, > > + }; > > + unsigned long i; > > + void *entry; > > + int r; > > + > > + entry = attributes ? xa_mk_value(attributes) : NULL; > Why attributes of value 0 is considered not a value? Is it because 0 is not > a valid value when RWX is considered in the future? 0 values don't require an entry in the xarray, i.e. don't need to be stored and so don't consume memory. The potential conflict with a RWX=0 entry has already been noted, but we'll cross that bridge when we get to it, e.g. KVM can easily support RWX=0 by using an internal "valid" flag. > Both the changelog and the document added mention that the address and size > of attrs will be updated to > "reflect the actual pages of the memory range have been successfully set to > the attributes", but it doesn't. Yeah, on the todo list, all of the changelogs are horribly stale.