Received: from mail-qk1-f181.google.com (mail-qk1-f181.google.com [209.85.222.181]) (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 D9DE023C50A for ; Thu, 29 Jan 2026 00:37:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769647078; cv=none; b=tdUm7UkTsricXweAm2dM3OZ6Cs9H8Sqpo+sIogw0hAP+mGlUz5Va66144xmZWu2nCDqm6upY1HVR3Ms+2tPj8IXPVpgpoHnbfgEtcLmNXIJC1A1XStcsS3tuCDagQeh1VAZtEAcekmBvfYXraGMue7Zfade+wfc/JPOiwXMs9kI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769647078; c=relaxed/simple; bh=tXNj0V0FG3jDHp0sl6ptuF//zDhb0DbdK89SgU01AH4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WaU3JNLIe3dWx6ToHTfW8gbKIJQ5AUks60DpF8Qgn1isaY+7fTGGBxOoGiwPr06DS9fcsTKSgYTA/BfQxUfN0pnHmtD7sn/mZcsnLlCnGBpF21cQscxbom8ooOh+ByMi9IgfghFisT3a7SPl0iBC0vYa8BAxvOtAXppmlH7h3rM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=k3z974Mo; arc=none smtp.client-ip=209.85.222.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="k3z974Mo" Received: by mail-qk1-f181.google.com with SMTP id af79cd13be357-8c0f13e4424so59588285a.1 for ; Wed, 28 Jan 2026 16:37:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1769647075; x=1770251875; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=1OWzBPKnyrz01i64zQ4S/hZaAIPcGy0JKcdMQLZXMgA=; b=k3z974MoBekrskW+4yDuSvtzoUeR4tzTJU2yvyD4rQigVuBdm4BzN3Xg8Zzela1ij1 PtIBJOHG+48zicSasaJj88LsAp9Idss6arEvECeDPDvI1+/bGMecOxg2xZIYwnFVlh0e N0DvTFOVBrdLgm2SKMS+gRiwkBiRJcJWUntisKKjBYWClnHFRtNhDwWc+rSNwr+1UjqW hx681JKT5lyNNWCAUjt1BcDoxqd1Xi1LEySTm+fAhUY0zEB5n4V31HSnaVxU+vLpaw6P OslVl70bntspz23oY0Aox/yOyL0R7Sg8jXzzls2Zxn0sc+rXC4pcAybAV0qWKdtqzTn8 u/Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769647075; x=1770251875; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1OWzBPKnyrz01i64zQ4S/hZaAIPcGy0JKcdMQLZXMgA=; b=lAyLVXZd4b7cUOwcc0OuSovZg/xqupcjxnkROb0f0/fgZsZPVIzfTobAIB3zsVEI1v 6IFmDnPLkg8tJ+Qca/9LlfAlS8185W7vqqEAbKhdDMndF3EyOp/Ahop1P/bxV6nYnGPI uGItxWyqQOsD6y9/Xxy5iKNfXFjlXFYsjYynXH06xUYTMy9ATpjTL2SVbFx9zjm8wdjT zzWJMHMdmTp2YYggeB4FrZakbVARrCJOxZvxPcwUH50eGxZ7qyPFo3uJNzuPERfhaMrU DTyc/0IQdkwxOfmpvCDAIqspS2p0lJumICDm36650uo0INWHr1EvAI5unQ10jSJRGwg6 QMMw== X-Forwarded-Encrypted: i=1; AJvYcCXKjYpIpPf/75zXDAlWzBT2vmfLcuGMrJzfyzMK8hlpHStdWJOWE7dT/LfwHp03iM8WeTzF6gHP@vger.kernel.org X-Gm-Message-State: AOJu0Yyihsd10e8RUjuA5jirSoVZHSdqTr/gr/YbMUABEI935xcgecep Fy60khy3KHDi3hPo0g45Je21Pm6F0h0DGGZgH04SO/dJSk660IBXaa+kvz0BuujL+fo= X-Gm-Gg: AZuq6aKb4kDTnFsW94eYr72T4KQ6jF7sGZVL91lF7shwP4VHNI9B4yBIzKiMfoQOc8E w0jG1g/+fFl/T/gzBJzLjsDVP78B7h/NYwc2EJJo3DNMAYwAFMjAPBqgPIcFT1lSY8Qifo+Z78X HOrsdiF6bS/2gxsQP94/NLYA794X/VyiEe4rB1GXXSC5dWWj6BX1noGI44rYvJ26VVESzP1sIXk AGoOF30qSDJVQq1+qFbDD2KpoQx8i7fo8o0X52gnUx7EKtk6D5yhzy8q0kmOOmitbQEbGlRiaMf uzdb24LaiHJuvSUX80Vj+RjAPJRk4P9qc5NIWUWiAVThrzceMPvg/qtFtn3G4p98eVkDsP3Jcoe PMTrZV/d52PbeJfYbfQyFts7i55SOi/clNGc7FzrSh4zq/r3En7k8BACGcRucF2rsofu3lTPJXO ZXOhuWvSfcCKyf5RFVdqOF+QSiiHpmfdWACr7IBLdaeINUtVhGQKVepLVmeqRbvt/+mDk= X-Received: by 2002:ae9:c202:0:b0:8c7:126e:e901 with SMTP id af79cd13be357-8c7126eeb1amr465687985a.22.1769647074488; Wed, 28 Jan 2026 16:37:54 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-162-112-119.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.112.119]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c711d29aa2sm294243485a.35.2026.01.28.16.37.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jan 2026 16:37:53 -0800 (PST) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1vlG2j-00000009g5p-04Lm; Wed, 28 Jan 2026 20:37:53 -0400 Date: Wed, 28 Jan 2026 20:37:53 -0400 From: Jason Gunthorpe To: Ackerley Tng Cc: Alexey Kardashevskiy , cgroups@vger.kernel.org, kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, x86@kernel.org, akpm@linux-foundation.org, binbin.wu@linux.intel.com, bp@alien8.de, brauner@kernel.org, chao.p.peng@intel.com, chenhuacai@kernel.org, corbet@lwn.net, dave.hansen@intel.com, dave.hansen@linux.intel.com, david@redhat.com, dmatlack@google.com, erdemaktas@google.com, fan.du@intel.com, fvdl@google.com, haibo1.xu@intel.com, hannes@cmpxchg.org, hch@infradead.org, hpa@zytor.com, hughd@google.com, ira.weiny@intel.com, isaku.yamahata@intel.com, jack@suse.cz, james.morse@arm.com, jarkko@kernel.org, jgowans@amazon.com, jhubbard@nvidia.com, jroedel@suse.de, jthoughton@google.com, jun.miao@intel.com, kai.huang@intel.com, keirf@google.com, kent.overstreet@linux.dev, liam.merwick@oracle.com, maciej.wieczor-retman@intel.com, mail@maciej.szmigiero.name, maobibo@loongson.cn, mathieu.desnoyers@efficios.com, maz@kernel.org, mhiramat@kernel.org, mhocko@kernel.org, mic@digikod.net, michael.roth@amd.com, mingo@redhat.com, mlevitsk@redhat.com, mpe@ellerman.id.au, muchun.song@linux.dev, nikunj@amd.com, nsaenz@amazon.es, oliver.upton@linux.dev, palmer@dabbelt.com, pankaj.gupta@amd.com, paul.walmsley@sifive.com, pbonzini@redhat.com, peterx@redhat.com, pgonda@google.com, prsampat@amd.com, pvorel@suse.cz, qperret@google.com, richard.weiyang@gmail.com, rick.p.edgecombe@intel.com, rientjes@google.com, rostedt@goodmis.org, roypat@amazon.co.uk, rppt@kernel.org, seanjc@google.com, shakeel.butt@linux.dev, shuah@kernel.org, steven.price@arm.com, steven.sistare@oracle.com, suzuki.poulose@arm.com, tabba@google.com, tglx@linutronix.de, thomas.lendacky@amd.com, vannapurve@google.com, vbabka@suse.cz, viro@zeniv.linux.org.uk, vkuznets@redhat.com, wei.w.wang@intel.com, will@kernel.org, willy@infradead.org, wyihan@google.com, xiaoyao.li@intel.com, yan.y.zhao@intel.com, yilun.xu@intel.com, yuzenghui@huawei.com, zhiquan1.li@intel.com Subject: Re: [RFC PATCH v1 05/37] KVM: guest_memfd: Wire up kvm_get_memory_attributes() to per-gmem attributes Message-ID: <20260129003753.GZ1641016@ziepe.ca> References: <071a3c6603809186e914fe5fed939edee4e11988.1760731772.git.ackerleytng@google.com> <07836b1d-d0d8-40f2-8f7b-7805beca31d0@amd.com> Precedence: bulk X-Mailing-List: cgroups@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Jan 28, 2026 at 01:47:50PM -0800, Ackerley Tng wrote: > Alexey Kardashevskiy writes: > > > > > [...snip...] > > > > > > Thanks for bringing this up! > > > I am trying to make it work with TEE-IO where fd of VFIO MMIO is a dmabuf fd while the rest (guest RAM) is gmemfd. The above suggests that if there is gmemfd - then the memory attributes are handled by gmemfd which is... expected? > > > > I think this is not expected. > > IIUC MMIO guest physical addresses don't have an associated memslot, but > if you managed to get to that line in kvm_gmem_get_memory_attributes(), > then there is an associated memslot (slot != NULL)? I think they should have a memslot, shouldn't they? I imagine creating a memslot from a FD and the FD can be memfd, guestmemfd, dmabuf, etc, etc ? > Either way, guest_memfd shouldn't store attributes for guest physical > addresses that don't belong to some guest_memfd memslot. > > I think we need a broader discussion for this on where to store memory > attributes for MMIO addresses. > > I think we should at least have line of sight to storing memory > attributes for MMIO addresses, in case we want to design something else, > since we're putting vm_memory_attributes on a deprecation path with this > series. I don't know where you want to store them in KVM long term, but they need to come from the dmabuf itself (probably via a struct p2pdma_provider) and currently it is OK to assume all DMABUFs are uncachable MMIO that is safe for the VM to convert into "write combining" (eg Normal-NC on ARM) Jason