Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp778506pxb; Tue, 14 Sep 2021 08:32:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBHU2e9sIgKbT7dCEvvzclocoQ+tAOs5L0quPBG0eH9BdHZ5iLYeYKXxzJimZztbUfts1D X-Received: by 2002:a05:6512:2296:: with SMTP id f22mr13258191lfu.547.1631633538249; Tue, 14 Sep 2021 08:32:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1631633538; cv=pass; d=google.com; s=arc-20160816; b=fWd9hxz+bRfSMpYhRrVAaTQ2IXr11CGVVSZ4EsbI1viWOP9Qy8KW7yMI5kvkElBUlT 3ICeTEx9ZRmOOW+EoMvug869t1ktr7d13lwGpuikCY9RxRneQCO5EErUEjZMKQwMmaNF QtlfPa7uqWdVUid9bhbtWs8g7TxHQHHoT8GTTtFZoamB12ChH6S2fpjjvc6D5IOtZfzm xwxs8td0vzOk7L4GAHO33aiih7Xx/2VV3gznhBMKLn5uALiEQTuiyO98KDhRwzoAYjxv NyGJLjmLLxJMlKokl4HalqjiYaKrTggAgqUYsqtMyZBztu5qoMRJucyHig/RGBxkpkhm dsyw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:in-reply-to:user-agent:date:message-id:from :references:cc:to:subject:dkim-signature; bh=hhWzPqc+baNtksScInoyMTGZMgEM+jvg4iBfu2+k9DA=; b=gXONoWtolPSph2krgorgRvAJypVq6xxWkroOOCGQ1IU0HWSSlwXlCDOjKBq5/PuvAX cjsD3cfrh9hf7voR0m8BSpzHf1GbMXGzeunH8zw5U1/54WcZ4u8Wp64MdJ9VsdrRA+CR WTEJpmtHcZNp4H3yR0CroiCttKuvaIO6Ax8edwxvOuMMVerOnP2mdRI94S4/qOqfwUZF cLL7ILHp8xBL6rIhWIM17p9r7JCaMGDvKSfLekBD7DPDPrM7eGRBABIS3eKx0YazIOsX DEDkfUYOlLMVf6bVSRS8/Gynq0GtzyZbW1eEzJhKkoiYWu3AFeu1jKSfY6wN5vV2hTmC lMcA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=mimecast20200619 header.b=Ci7BohGN; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u2si4726619lff.398.2021.09.14.08.31.48; Tue, 14 Sep 2021 08:32:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=mimecast20200619 header.b=Ci7BohGN; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234521AbhINPad (ORCPT + 99 others); Tue, 14 Sep 2021 11:30:33 -0400 Received: from de-smtp-delivery-102.mimecast.com ([194.104.109.102]:39613 "EHLO de-smtp-delivery-102.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233875AbhINPac (ORCPT ); Tue, 14 Sep 2021 11:30:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1631633354; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hhWzPqc+baNtksScInoyMTGZMgEM+jvg4iBfu2+k9DA=; b=Ci7BohGNFAqwR6KZtF+hLRGGq6Vo5ezkQ0d/lxK644/4bXw7G1wip08Z/9i3qaez55vbRS VKOBnOAYEQiY5Umvgb5zM0WkkekceV1fsW5hvB933XopjtXzMxjbokMMkQhDpPzoRJKAPu 8fOyHYr5z3CBVgP9yU2werzZ3WMvtPo= Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04lp2050.outbound.protection.outlook.com [104.47.14.50]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-15-G5eDJQa8NLqkuyWUKAJ4qg-2; Tue, 14 Sep 2021 17:29:12 +0200 X-MC-Unique: G5eDJQa8NLqkuyWUKAJ4qg-2 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== 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-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 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; Received: from VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) by VI1PR0401MB2334.eurprd04.prod.outlook.com (2603:10a6:800:29::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.15; Tue, 14 Sep 2021 15:29:10 +0000 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b]) by VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b%7]) with mapi id 15.20.4500.019; Tue, 14 Sep 2021 15:29:10 +0000 Subject: Re: [PATCH] swiotlb: set IO TLB segment size via cmdline To: Roman Skakun Cc: Andrii Anisov , Roman Skakun , Jonathan Corbet , Thomas Bogendoerfer , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Konrad Rzeszutek Wilk , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , Christoph Hellwig , Marek Szyprowski , Robin Murphy , "Paul E. McKenney" , Randy Dunlap , Andrew Morton , Thomas Gleixner , "Maciej W. Rozycki" , Muchun Song , Viresh Kumar , Peter Zijlstra , Lu Baolu , Mike Rapoport , Will Deacon , xen-devel@lists.xenproject.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org References: <20210914151016.3174924-1-Roman_Skakun@epam.com> From: Jan Beulich Message-ID: <7c04db79-7de1-93ff-0908-9bad60a287b9@suse.com> Date: Tue, 14 Sep 2021 17:29:07 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: <20210914151016.3174924-1-Roman_Skakun@epam.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: PR3P193CA0051.EURP193.PROD.OUTLOOK.COM (2603:10a6:102:51::26) To VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [10.156.60.236] (37.24.206.209) by PR3P193CA0051.EURP193.PROD.OUTLOOK.COM (2603:10a6:102:51::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Tue, 14 Sep 2021 15:29:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 074dfc55-95fb-49c7-e925-08d977946657 X-MS-TrafficTypeDiagnostic: VI1PR0401MB2334: X-LD-Processed: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba,ExtFwd X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RYoU3P+Y0RnTn+IGj2fzDOBGc0v8jOjAO4pN2pmc16lKx818yevzS30dMvhdz8ceOWjTOkEM2fwnNDUASKTZayhy9rTCD6v1kleeE95zvxxPwyMpZh1lfXPQ3JKpsnonX5LNEh3Vu1fbmXdFeqqKzz25vgPzSSbLV/OwqEQknaLDrzwnfTgeznDqJWjxlsVcC9sYHoDrLtB49Fvsh6IlCpGm8/wpByf/wdbjoTMl9Pt+dRkWZugoeRByDq0FzpAimYt+VNZPTzTqOVlw8On5eQ3VpG/OSAk4ObykCcm8oUPoV4SzRiyhIfLq9/DBSQuXKAaHQd1wPwq97F68XgxDHeVH/PSatmhRN8/zckvBgT1UYVfP5jSY+my4czYnYpTWo6CblQ9i/fB/cSMhISvjqOC6hmc+3k0UNmIGSEQtdhhh+HTFaiKuXSYOwOQ4cRE06uiboKxXkhyKGbpdhRcoNKsQ+HTDZcTGkgoaVFampZVCZRNALVZqsKyZwoVX7qnJasU0zOUq5sEAyOPU0L+WsdKd5UniZpYJQuStlHxc8ljXn64I8NDE5XHFvJwXo4d1KeKcB76a/WB8j8+PuBbjjxFwSOSnW2HnDzuxjHdSjzNTl2IjkMcsMKSTv4PT4BEpED6FeRw0QTmFwVZHmyvw+2GLuz4rdzFWqyrzzf+pGwLNmzz6/02MjNVBc0sZJMVKLIgzSuLM4PKzYwoda1zxRzGztL+b4kMyNTKFStZFPzGStXTgpwAuWdUTGqW5YCw00LM+SoDKifedQtHjkZnHZyVI8YPbDerPxyC8d4Dv4deopMYuAlO12AuSlGEIRTCc X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5600.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(346002)(39860400002)(366004)(396003)(136003)(376002)(6916009)(86362001)(66946007)(966005)(16576012)(38100700002)(186003)(316002)(5660300002)(6486002)(83380400001)(7406005)(7416002)(478600001)(54906003)(66476007)(66556008)(4326008)(31696002)(2616005)(53546011)(36756003)(956004)(2906002)(8676002)(31686004)(26005)(8936002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkC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VRjbThp?= =?utf-8?Q?EHtteRfnHGiG4VVIJeSMsg07Np7Q1JnvbOEPUBb?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 074dfc55-95fb-49c7-e925-08d977946657 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5600.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2021 15:29:10.7377 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kXdQssFPz9rIrTB1YSXP35DiSNUdVE4BfSOJKHu3+j7Ku5TB+6FgftUS2/Mi3A3sAouc4CUWJBS2Nck1t6XQaA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2334 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14.09.2021 17:10, Roman Skakun wrote: > From: Roman Skakun > > 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