From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 10256DF51 for ; Mon, 14 Aug 2023 21:54:34 +0000 (UTC) Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-55c964d031aso8936769a12.1 for ; Mon, 14 Aug 2023 14:54:34 -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=CURi/WGYBSwYN1mptTCgb6IC381/anDr2CBP5uHdo+LyP9ir2gsvLvhAT/FEyIurk4 JR/eTC7Ah7jYSq2XenPSsh6tHlN9D8vUnlA3pay9W4tcU386LVe1YiWauSl+EiicYFxs XPnmvWDjswKpCG4jtKVUwXJ1rvr+756pCWV9D3hChrg4ZIfxYok5v5Kcz7Lwd+btirdE znTD7Y8fff+YOObUdOO/vtuPJ/iXSBtUDUCgGnQTF/0A61rmuR/VgnoLoR0CsoU6TtaF U1aIq9awOCE7jVn5YqMA4l2YaRKXHnAYKV6rMg6oq5Tzoh6E3JsYsOAqMKcUoxBMQcrL /0eA== X-Gm-Message-State: AOJu0Yw6FR0rvG5CuPyZequDSqTOwW5K4ClV+LF8nIvXU8kKpBMLDjwR 9m+phnEk/L/paHo5CMadYNCefnyGiww= X-Google-Smtp-Source: AGHT+IGPzyG2ye2a1feyqcG86dyCHC82qzx5i2/p6ALHRmr0rfFoFMM8MlFz9jxGz9wjwtqC3ppaRbddXVE= 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> Precedence: bulk X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: 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" 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.