From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (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 44350377AA8 for ; Fri, 7 Aug 2026 18:14:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786126441; cv=none; b=F5DKC0jBmpiPfasR9omKB2S5sDiES80CUmxrMq1ibuqiAOR7F48JCZA/YCD+KkaHHs1fFhE7yvgyAjSHzK4ZBVxRxXMeTShPeVaAm2pnyXlV/YzqiVUZhdy3Udy3s6csGdLiVzCGt9oVXwLBp66c/Qeg7qa80NzLszrdAr9Xk+g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786126441; c=relaxed/simple; bh=E7Ex4RBUa7IG4kdLmTYk7y3iUle3Rq8qAnZNO/0MU2c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ayk2/+rHNRDxWxQ6K60rrBawdFzxF3dvsk1x9iIrfKvIFUdvAD9DQU/1FE/tdPenrOC/+tRAIRMAYskkX8YzOGq/wgByKrrghWqjTh69CfVnma8rTDHUQmg3fhej3fb2405WcSKGUpRH0t75+eG6XIuZB+N5LvNUk5FnHr35ulc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=nyxUypfJ; arc=none smtp.client-ip=209.85.208.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="nyxUypfJ" Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-6a177b2dc8dso1027a12.0 for ; Fri, 07 Aug 2026 11:14:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1786126438; x=1786731238; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=NlmgqKiyqc7mU7pAn/JSXJE8TLhKwTlI/zLMMe65kC4=; b=nyxUypfJk9ldvGOs0r00RtaAwiR+rMq5xQ6XKKT7lVl10OAXCHv6k57CTXOcgg9vIS 4KtV7QHh9CsJ8E20MJlv/VnFTSK5Svnr2oKQfJEJBmELLzvE6fk0h3ZIoHb87C/FnuS3 TLNZV6n2ivazyk3aC2CzkClR7sf9XogrSDKqpDmenXhPcRsf0ViDoo8P1aDyH9kfcPeK QfXz7RFzk7YLqUSwCWXXIdP1KDsC8SAgQYA+hODQOZzHn68HCCP9vaJneVMYRDfJmgYP Rf/eH4mMdW9leqSTH/3jR9UGhaEw7vx6Gz5+ct1yjXNE/Bubsn52AzY12lT3Z/vdySdG fifg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786126438; x=1786731238; h=in-reply-to:content-disposition:content-type: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 :content-type; bh=NlmgqKiyqc7mU7pAn/JSXJE8TLhKwTlI/zLMMe65kC4=; b=GyvEimSMUCrhsZjV1zTtw/yF72m2hoEcaFSHv/eOGrxV+jTwsaC5sUa+qLQoeYw1Tm d5wiBdBpHw6SK2qk5vzyXz/RdErH4/2kAepafIiFlkYjeM+0zufnmxVUOY2xukleMqsu ids242xtpDURogeRM1BdN0OyjFzHlTsWAVFPxjqetRgQLYmrknD2cfGDKWAK0KQ2J9PL 4IQoxOUCzl1sDqv2L/bNZkaooCWe2a3ALxoyvWMAAetOD3dNQ3D5T7JsX/x7lyzxzY22 Pc/0JjcQsOlW86FfAK/1GNFPkxjU8D1MOjR48Eq83p/Ow233E5vMT2GlkSY0nKzvp4zT dCJA== X-Forwarded-Encrypted: i=1; AHgh+Ro+KUquLUDrrdVD2fjP4C9519Jp49E3cO4m55cWoaGb5aeHBMbbIeteOGGeRYEkAlylIKbfs2btYjddV1w=@vger.kernel.org X-Gm-Message-State: AOJu0Yx7KYQN9Ks8s9k0bcHjOkicpJ3/7J3gEr94K1MK4f62X2hQWv8f uXxPUA7lRAv1dP6F33vUq0pmyHWWXeEc04eQxX6mOSocAFvQlAhYp3KbHXPX6RyHdA== X-Gm-Gg: AR+sD12XG4ggqYhOp8rwoZ+qUTGW0N8CcbEzPKERf6aUJ1UH1xRJk/tadWbu5LZ9e/C DUv4dpbNJdzdoyuDcQ3RwL932zkwHQG5RCvUrVLwuf6davW1a50//VtDxzZQqZmw8tPJZ/cNZ8t ZLXuK+aPuQcLHPTW3PaFGZWhQZN/5fhE8dvwBL+i7pjYjiqIX9iZi+eCgol+NGGYMhvCH8SVeBa M17DtYH6M9wjJ7A7iKrgXtbOLtzNFnFGsuKMiERFe2LrXkPd01Q/iq4qxrvXIbCf1O3Orez9Tna VJd3MbbHLR7zL1mN04qsF07kwTy6moWzqR4J3HVqCByGfjP0RWkn7fxIfXH7kzfJYoZdF0WIUGE O/zYf8kmyXammunLm8KzNSFZIg0mhJvGG8XJaQH2u/fTB58ebTXSYijqxtPcUwwG9gI51d3dxVC 0fj5ktaCouzA1qPxEEGrjt9d3J+ruVSvHa12Cx2jUF2nNniQ/HpQiiRmVtdcVR3lEfnTnxncA7x PzeZlNm4QPWjDaUJpYQ5DrkMCG1yw== X-Received: by 2002:aa7:ce06:0:b0:6a1:f26c:ae2d with SMTP id 4fb4d7f45d1cf-6a1f4f438f9mr5439a12.6.1786126433777; Fri, 07 Aug 2026 11:13:53 -0700 (PDT) Received: from google.com (250.192.189.35.bc.googleusercontent.com. [35.189.192.250]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c2080ab446bsm79186966b.27.2026.08.07.11.13.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Aug 2026 11:13:52 -0700 (PDT) Date: Fri, 7 Aug 2026 18:13:49 +0000 From: Mostafa Saleh To: Jason Gunthorpe Cc: Will Deacon , "Aneesh Kumar K.V" , iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-coco@lists.linux.dev, Robin Murphy , Marek Szyprowski , Marc Zyngier , Steven Price , Suzuki K Poulose , Catalin Marinas , Jiri Pirko , Petr Tesarik , Alexey Kardashevskiy , Dan Williams , Xu Yilun , linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Alexander Gordeev , Gerald Schaefer , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Sven Schnelle , x86@kernel.org Subject: Re: [PATCH] arm64: swiotlb: Keep the default size for protected guests Message-ID: References: <20260717180442.110954-18-aneesh.kumar@kernel.org> <20260807092612.2202005-1-aneesh.kumar@kernel.org> <20260807135810.GA200537@ziepe.ca> <20260807164734.GE200537@ziepe.ca> Precedence: bulk X-Mailing-List: linux-kernel@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: <20260807164734.GE200537@ziepe.ca> On Fri, Aug 07, 2026 at 01:47:34PM -0300, Jason Gunthorpe wrote: > On Fri, Aug 07, 2026 at 03:34:47PM +0000, Mostafa Saleh wrote: > > On Fri, Aug 07, 2026 at 10:58:10AM -0300, Jason Gunthorpe wrote: > > > On Fri, Aug 07, 2026 at 02:18:31PM +0100, Will Deacon wrote: > > > > > > > > I was under the impression that there is a possibility of using swiotlb > > > > > instead of restricted-dma-pool with pKVM. > > > > > > > > Yes, that patch enables swiotlb as a possibility for protected guests > > > > but with your patch we avoid shrinking the swiotlb buffer even when > > > > restricted dma pools are being used and that's a waste of memory. > > > > > > I also thought we switched pkvm to use CC-like swiotlb as part of the > > > alignment in this rework? Mostafa ? > > > > Yes, now protected VMs can use the SWIOTLB for bouncing. However for > > Android (and kvmtool), use restricted DMA. so SWIOTLB is not used. > > Oh? Why? > The patches are not in Linux yet, when it eventually lands in Android it should be possible, I did some initial assessment and did not see any regressions. > > However, I do not think we should over engineer this in the code, > > swiotlb can be set from the cmdline and now through Kconfig also. > > That's fine for android, but real users buying a cloud VM and sticking > a distro on it shouldn't be expected to have to mess with cmdline just > go get a halfway working system But the whole thing is best effort anyway, the kernel picks IO_TLB_DEFAULT_SIZE which does not depend on the system topology or how many devices or how much DMA they do. SWIOTLB memory is wasted if unused so we should be careful around that as it would be the other way around and users would have to decrease it manually. Thanks, Mostafa > > Jason