[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] swiotlb: set IO TLB segment size via cmdline
- To: Roman Skakun <rm.skakun@xxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Tue, 14 Sep 2021 17:29:07 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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; bh=hhWzPqc+baNtksScInoyMTGZMgEM+jvg4iBfu2+k9DA=; b=QJXBGHRJoxVYSgQKR75ZqtQBu2JWN2ijj7/zhZhbrHSbInJOTW8wp8HgnVgJZ3os0DY5EQ++b4XgpKsUB8vWoVhMwmQfPHOwb++lBH7KPqcomUWK+bjJykWjWLv3+l9078TL25bjJ+A/ESIDB4hidja/xztszSGjyCDorde6oWh7RAx9/o9A/lVCp5P/oPvUAXAAnUPTIus96qxT2LrYnwQZjnb6/VxOT2kZFZnYUdAwuxWeyywkE8RD6/Xnkt44oi6zYOISTow27UQIayqgcn1bGRXoO18PfL2CxfaC/wadWMOJBx2MnnqdJ8VrrbewgTRVlPpriMLqeMUHyzs3cg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UBAA5TupC446mVSVjKo9V+J/Iu2eC6Fb9hV9F7LdCa/pTPM1LXOq3n7wdIh/W6iKArAJegcUaGTVUFwXKmlJ1vAwO0ulUp3u4AzA/3JfCtTv+Ns/q2J9H8P00HOrWojtu0LTVrPPEL3GcP+ydQJkVcAfW581SvJTdg3hjIuTrQ9fQi/vQO4E0OZHSdIG1piC015SXDF5HOPlUeGDSnOOKuel1gmHgL7wLhKNtepAwlTKj6ibcWaO9FQCrkhzIJf1fOl+2viAxrwkkz99Utk4vL9DqEkuPtp/3Wn7ACyxbTI5IAeRSUg2d51XUSqA4XocQ7nbc627yErH0R91ZFTk5g==
- Authentication-results: lists.linux-foundation.org; dkim=none (message not signed) header.d=none;lists.linux-foundation.org; dmarc=none action=none header.from=suse.com;
- Cc: Andrii Anisov <andrii_anisov@xxxxxxxx>, Roman Skakun <roman_skakun@xxxxxxxx>, Jonathan Corbet <corbet@xxxxxxx>, Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx>, Michael Ellerman <mpe@xxxxxxxxxxxxxx>, Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>, Paul Mackerras <paulus@xxxxxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Christoph Hellwig <hch@xxxxxx>, Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>, Robin Murphy <robin.murphy@xxxxxxx>, "Paul E. McKenney" <paulmck@xxxxxxxxxx>, Randy Dunlap <rdunlap@xxxxxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, "Maciej W. Rozycki" <macro@xxxxxxxxxxx>, Muchun Song <songmuchun@xxxxxxxxxxxxx>, Viresh Kumar <viresh.kumar@xxxxxxxxxx>, Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>, Mike Rapoport <rppt@xxxxxxxxxx>, Will Deacon <will@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, linux-mips@xxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, linux-doc@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, iommu@xxxxxxxxxxxxxxxxxxxxxxxxxx
- Delivery-date: Tue, 14 Sep 2021 15:29:24 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 14.09.2021 17:10, Roman Skakun wrote:
> From: Roman Skakun <roman_skakun@xxxxxxxx>
>
> It is possible when default IO TLB size is not
> enough to fit a long buffers as described here [1].
>
> This patch makes a way to set this parameter
> using cmdline instead of recompiling a kernel.
>
> [1] https://www.xilinx.com/support/answers/72694.html
I'm not convinced the swiotlb use describe there falls under "intended
use" - mapping a 1280x720 framebuffer in a single chunk? (As an aside,
the bottom of this page is also confusing, as following "Then we can
confirm the modified swiotlb size in the boot log:" there is a log
fragment showing the same original size of 64Mb.
> --- a/arch/mips/cavium-octeon/dma-octeon.c
> +++ b/arch/mips/cavium-octeon/dma-octeon.c
> @@ -237,7 +237,7 @@ void __init plat_swiotlb_setup(void)
> swiotlbsize = 64 * (1<<20);
> #endif
> swiotlb_nslabs = swiotlbsize >> IO_TLB_SHIFT;
> - swiotlb_nslabs = ALIGN(swiotlb_nslabs, IO_TLB_SEGSIZE);
> + swiotlb_nslabs = ALIGN(swiotlb_nslabs, swiotlb_io_seg_size());
In order to be sure to catch all uses like this one (including ones
which make it upstream in parallel to yours), I think you will want
to rename the original IO_TLB_SEGSIZE to e.g. IO_TLB_DEFAULT_SEGSIZE.
> @@ -81,15 +86,30 @@ static unsigned int max_segment;
> static unsigned long default_nslabs = IO_TLB_DEFAULT_SIZE >> IO_TLB_SHIFT;
>
> static int __init
> -setup_io_tlb_npages(char *str)
> +setup_io_tlb_params(char *str)
> {
> + unsigned long tmp;
> +
> if (isdigit(*str)) {
> - /* avoid tail segment of size < IO_TLB_SEGSIZE */
> - default_nslabs =
> - ALIGN(simple_strtoul(str, &str, 0), IO_TLB_SEGSIZE);
> + default_nslabs = simple_strtoul(str, &str, 0);
> }
> if (*str == ',')
> ++str;
> +
> + /* get max IO TLB segment size */
> + if (isdigit(*str)) {
> + tmp = simple_strtoul(str, &str, 0);
> + if (tmp)
> + io_tlb_seg_size = ALIGN(tmp, IO_TLB_SEGSIZE);
>From all I can tell io_tlb_seg_size wants to be a power of 2. Merely
aligning to a multiple of IO_TLB_SEGSIZE isn't going to be enough.
Jan
|