[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 7/7] swiotlb: don't override the command line in swiotlb_adjust_size


  • To: Christoph Hellwig <hch@xxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
  • From: Tom Lendacky <thomas.lendacky@xxxxxxx>
  • Date: Fri, 23 Apr 2021 00:23:23 -0500
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RY4G4M8QTTcCTu/5KMbW8BSCWDpoABobgoE4sdkLTIw=; b=eYbjiwkYASj4izCcquz/ond7cNB12CCIbqdenUlz2ttrTPGkuyVltP0epsGdOE8oasEX4cUinYjSNiBkka3/8A9ovHh8ZPnrINv1Wslll5sTXLNn/i43F+ECCA99nWVUtVvfRH97kAdOGm+X3B6hvAeoQna2qo+VMYgG380CA9oVstMKFFEcm5JDLPvJJI/jEDM02+3+fR3476U6OJNqrxTHt68McQyG0OcnHPMYMC1tbCczaNpcqMAe1P4v96qXsay8XvzSzbGsXObSVOANGjc4RAFlWmwXemXMtxyh3qqtZl/cplzKWXth5YGb4cAyUF8y0cMhqMf/G6shIMpPuA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JJdvkTTJk+AUHTv+SJXmJv5YBSjkEE6GJ3NrLHWN5EwKhs9o4R3xEC3XME339IuM0Q+Up5e50VN2Zc2/Zj/BdF5DhBjcQssU+RkX59g7Z2oR0lHrAs5EL7XhcFddtkww93R98A47Q8hYbyBY4TFieYPzXsNHtb+xJ1ca7htsTsJKzYRgvzYxjgRcLCdSyLRIYzDXakUmdVe09hbVTLARZNPn4zQE/4Zt3WWwsr15mtG40sLk50/UAMh0vf/Flp6A3tVQdYFZyyK6SO1a34h9k85LrgcXB5iKSGi7PZOm+p4VdKSC1GUybUFhnPOjfdUMR+1hll2egiSnNElWMaN7SA==
  • Authentication-results: lists.linux-foundation.org; dkim=none (message not signed) header.d=none;lists.linux-foundation.org; dmarc=none action=none header.from=amd.com;
  • Cc: Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx>, Michael Ellerman <mpe@xxxxxxxxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, linux-mips@xxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, iommu@xxxxxxxxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 23 Apr 2021 05:23:44 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 4/22/21 2:19 AM, Christoph Hellwig wrote:
> When the user specified an explicit swiotlb size on the command line,
> the achitecture code should not override it.
> 
> Fixes: 2cbc2776efe4 ("swiotlb: remove swiotlb_nr_tbl")
> Reported-by: Tom Lendacky <thomas.lendacky@xxxxxxx>
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>

I tested this patchset and I'm not able to get the override via the
command line or via the SEV adjustment function. Looking at the code,
swiotlb_default_size is initialized, so the call to swiotlb_adjust_size()
always returns without setting the new size.

Thanks,
Tom

> ---
>  kernel/dma/swiotlb.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
> index 87d06ddf4753f3..aef02a3825b494 100644
> --- a/kernel/dma/swiotlb.c
> +++ b/kernel/dma/swiotlb.c
> @@ -106,7 +106,9 @@ void swiotlb_set_max_segment(unsigned int val)
>  
>  unsigned long swiotlb_size_or_default(void)
>  {
> -     return swiotlb_default_size;
> +     if (swiotlb_default_size)
> +             return swiotlb_default_size;
> +     return IO_TLB_DEFAULT_SIZE;
>  }
>  
>  void __init swiotlb_adjust_size(unsigned long size)
> @@ -116,6 +118,8 @@ void __init swiotlb_adjust_size(unsigned long size)
>        * architectures such as those supporting memory encryption to
>        * adjust/expand SWIOTLB size for their use.
>        */
> +     if (swiotlb_default_size)
> +             return;
>       swiotlb_default_size = ALIGN(size, IO_TLB_SEGSIZE << IO_TLB_SHIFT);
>       pr_info("SWIOTLB bounce buffer size adjusted to %luMB",
>               swiotlb_default_size >> 20);
> 



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.