From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com [209.85.219.54]) (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 1D2A33115B8 for ; Fri, 15 May 2026 13:36:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778852165; cv=none; b=pjMjf53y3ybNpureQBV6ZI/B7K8i2RxUq/uklxIXHFPYuraVmLMrW4hrTvoUVYI+0MJwOBFnmP4aZEXC5PTzZIIbT23PK/mzl7WrHwJZOG1nxTYGEeBDOsFsQWdbvvAq+Evdkr0iRsnRgTlFzZFlamd7ZH9iNx+d+gV6J4VH3Dc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778852165; c=relaxed/simple; bh=Fwd7lj78za7/egg1q8Mo4PUhAXSEVczLRrgBepYO3+I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lYjBnia8vxyrej5i/jKMdDLcxGRNvstYdKoM4T2BjLK9vfzeYvduXv1MgLU4NPdsWA4EAVT83o6gBoQH2MgofF2TxNP4Kz9paKExxs1PPqDS+QfXywVW10HEpMHuVqtCXdhoevAfHnlWz/V5gfHt+nzETUBGZRlyXpBQc4+yLq4= 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=Rx0/14+D; arc=none smtp.client-ip=209.85.219.54 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="Rx0/14+D" Received: by mail-qv1-f54.google.com with SMTP id 6a1803df08f44-8b7ec7bedcbso45562736d6.2 for ; Fri, 15 May 2026 06:36:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1778852163; x=1779456963; 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=Z72wSJNyYtME5egB+TN5Z3aN3HcOFHG2wgqQPaKQrhU=; b=Rx0/14+DCRdq5kCxCV5m8CLxfdI7RN6B6kxd5qTJcettXULU5mA27r6Jof2O9ZVLyr +p/mrbm0yZPApMlxgaktFPzMIviSIFjwDe7W2lWh0BA/hU2Zrx0pWyEnRKEO943dgXXK lUAGUzIoFzWWVL9ZzTasIkOjFGXKGHWfotmI468o+/DBGi6VyC541mBWgoF/jCo5KcGz Z7RbvaiKuaIcuGB4PmzG7Do5W03QV3386OBFB7qHzQAkqdv+MjcjgmlzGoxilNC/H9WJ hXlTbcqY2B7o5LTtQfUCE/TPjs16dtNW4ZhUktWgA1QWkBL/wW0dLgU1iql/aKBIjGDR YZsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778852163; x=1779456963; 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=Z72wSJNyYtME5egB+TN5Z3aN3HcOFHG2wgqQPaKQrhU=; b=bbxLdFZCMjxBC0YsG9D2xK4UInd5Cfl9A0WEiI34hAQohEnO/Vu2CjCSe9hXgmln3i asjwC4bxAxWoVoXi1jbS4wdcqa7iZ7PsYAEm8ff4EcHVnJ0p2gG6ArwrncTYB5Irlkpy 1/N54eeyldnX1F9TcS2T1lbUvs6+edv+qw4cF5wkAeuNMd/8cH2WN6fBWFYFljiU+R/Y qUeJEmlxOgI0kSRBPU0nbkuXh38j2U7Q5lmu/7ZC/OpLMhSG+w4r812oQTE3NJTJB6hR 4Fz9EP21ManGeK0Qfd3pokVQpjxz0v43Epn+Rng8wZ2rqjAD2pUHainxgFTbLtJq6eZ5 MqVg== X-Forwarded-Encrypted: i=1; AFNElJ/9LtpDH9uOv+fDXJ1dukwTGCemUqe0zmPx9ZhX4F5Ot78Lsx2AbEY0Cp7OUtscXsTPXfEVU5hEVy3okWU=@vger.kernel.org X-Gm-Message-State: AOJu0YyNUclQZD8dz2BzF0xjgubrHUDnuUj/tHRdoo0IOJw0+q911i0E dNsFp48m1xAlA0TIMuUqDQtR5fPXWt1m4gtjB24CkgsYdZn6u7Y6VX+QbCKH4P998/w= X-Gm-Gg: Acq92OHIpehIutVODA5Sb5kN+nknNmm2Sdt3Hpy48U0BNK4++xkK5xb1u2RY6UMEeT1 cxyB7Qrbu98KitY0+0i22p/Q6ZEQqPJofP0mFmTLOUqfpszoe/WitUUF2bkPVxeqMBSOGSxliij CeRvQIPLgG9FK5Do2zO55q5gS0AO8PClbfooIzdRm47ndFphmDncZ74m2jgN54o72sWa1RXEzc4 iR7Yo5dC/cMjey/6zeAb8UTTzOsVQ8VCbLK5mHq0GUu+rF85c8eIyt4SW7YBI8Fv2zotGic1Yju ZXRP2MzkDXBAD834axH87vCVeVN09wL3OT9mIZB2s1zVw844fgiLRvIESmYbcW1AYOWTkr8qcDE nXgRUHkWLP6hwNuLpM9C1AinQGiY6+KG45pmM6l3R8qdDunI4a4E+32WAe4m1Vt7acG4kleDPRr l+EEjQ/3yMFUTsYdyfSRvOCUufW2ihwrs65xMZV+TX8dwrJWVCcO6vi8517dkNuFnbvehm8uah9 FI+UA== X-Received: by 2002:a05:6214:54c2:b0:8ba:b699:9e54 with SMTP id 6a1803df08f44-8ca0f69b454mr69231826d6.47.1778852163065; Fri, 15 May 2026 06:36:03 -0700 (PDT) Received: from ziepe.ca (crbknf0213w-47-54-130-67.pppoe-dynamic.high-speed.nl.bellaliant.net. [47.54.130.67]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8c9093e62c5sm52289596d6.21.2026.05.15.06.36.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2026 06:36:02 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1wNsht-00000007QFF-3spW; Fri, 15 May 2026 10:36:01 -0300 Date: Fri, 15 May 2026 10:36:01 -0300 From: Jason Gunthorpe To: Mostafa Saleh Cc: iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, robin.murphy@arm.com, will@kernel.org, joro@8bytes.org Subject: Re: [PATCH 1/3] iommu/io-pgtable-arm: Use consistent sizes for page allocation and freeing Message-ID: <20260515133601.GF7702@ziepe.ca> References: <20260513215203.3852661-1-smostafa@google.com> <20260513215203.3852661-2-smostafa@google.com> 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: <20260513215203.3852661-2-smostafa@google.com> On Wed, May 13, 2026 at 09:52:01PM +0000, Mostafa Saleh wrote: > At the moment we use alloc_size to allocate memory but then there > is a logical error where we just size in the error and free path, > which might be smaller. > Also we size to do DMA-API operations, which is OK, but confusing. > > Instead of this error-prone handling, just set size to alloc_size > and use it everywhere. > > Signed-off-by: Mostafa Saleh > --- > drivers/iommu/io-pgtable-arm.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) Reviewed-by: Jason Gunthorpe This is similar to how iommupt works, pt_top_memsize_lg2() rounds up the top table size to the alignment minimum and we just dma map flush/etc the larger size everwhere. Jason