Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1864272pxb; Fri, 10 Sep 2021 16:25:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9WLOeoBg+CQSrcyWOTqr6EXUKaIA+aKqmat87OlOQ7e2BJ25QioFRTtdI859ykAZV2XCt X-Received: by 2002:a05:6638:2257:: with SMTP id m23mr163005jas.137.1631316349459; Fri, 10 Sep 2021 16:25:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631316349; cv=none; d=google.com; s=arc-20160816; b=e+DQxPJsmp7pYrhOYd6x5Du4On+TLDqUGpb4mYEGuOmhGWNbop3YFHTeCF6nVVZLoJ tEngfDedZ8fBA3JQJzIi4INWzxs5rcWtchARhgUpEOnUs219rU53ewi0pUfZZkbYicYe 1lm2H1Lhc1hylaSFwEughPNWFOsn5IVU9+h3yjTn+mNfGfcu4vuQfphRSysxgj7WQDdq s3AeFnjbtfSgXPn82a1or0QsvpEe/5uKBT+KwF6K8girK7ge8cCSAaWHEC8RBO65kbGm wI2HV419rTL2zVPSkxvwh+duu7JdShRSBZ/XriVRf4ujHceq6L8XyRbhW2MrNV08wzEG 8kFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature; bh=vWkEZj3jW0knj/UXT6A3Hg6dBJdRmBY+t9WrGGcyMpE=; b=txRGID90BBlha98hlwgpRUXhMB4pzJK1KJtcPmzritErcZmyNfgv5HZa81sXZhUk1/ yclTPVvYsO8fR1rKgdpda7V17JG4fOUlvzgLpYpkDbQPB1Y9swrDHa4w8LCDF0BH5qHp kiE5+IfCYT0yntY3kSn3HNaT0c9LgL8IDS3ztzUeYkijyf0YNsIcX41DnmQA1tjLTJU2 YJs2aa7RJrW/5fLlpnf5epGKFhQjOpMPKVgBh/Y874773h1xCNdXMW5h7hx8neqGHiS0 bgJ+SiJSnMtpBcsDhOAb+BMR8Sbbn7Lg+Dbe0ygul7ZBa/NlGac5XEwOr2127H4udxo3 3+Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TYKH7ZNK; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n14si6310946ile.112.2021.09.10.16.25.36; Fri, 10 Sep 2021 16:25:49 -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=@kernel.org header.s=k20201202 header.b=TYKH7ZNK; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234806AbhIJXYg (ORCPT + 99 others); Fri, 10 Sep 2021 19:24:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:33482 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234798AbhIJXYc (ORCPT ); Fri, 10 Sep 2021 19:24:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2949961206; Fri, 10 Sep 2021 23:23:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631316201; bh=N7LKktutD+QwQybp5f/rKrBsVZiJeC/R7umGYSMMqXk=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=TYKH7ZNKWMXywDAwVeL41AEHBwT+2Vzt7M/6twb7POXVBhQz+P2DkIFADYuFtOdGx LF5gd7EKeDKaPExyAi4PbCfFtOpf4PZKeC0CAoYYc7ez0923ROqEZUr7zW85B4ktpa lDlIki6s0Z4rv0McrrYS37v9U87OlK9g27aPge3XQfDC23vaKfSY+DESsMrbkfCJf6 VosSrN7sZEIiDmiae/9ba5j5NXfePWjNrK56ye2MER1IFu1M4Imlq6wZv8foOSJtF8 8QDQKcxjTlAh5c1MqN8Q6IUytTWPH7eBVXeIsK3kgdDK5RHZuOPPn4d6ft5vBuA0me boG9DR4Cs9CZA== Date: Fri, 10 Sep 2021 16:23:20 -0700 (PDT) From: Stefano Stabellini X-X-Sender: sstabellini@sstabellini-ThinkPad-T480s To: Jan Beulich cc: Juergen Gross , Boris Ostrovsky , Stefano Stabellini , lkml , "xen-devel@lists.xenproject.org" Subject: Re: [PATCH 06/12] swiotlb-xen: limit init retries In-Reply-To: <984fa426-2b7b-4b77-5ce8-766619575b7f@suse.com> Message-ID: References: <588b3e6d-2682-160c-468e-44ca4867a570@suse.com> <984fa426-2b7b-4b77-5ce8-766619575b7f@suse.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 7 Sep 2021, Jan Beulich wrote: > Due to the use of max(1024, ...) there's no point retrying (and issuing > bogus log messages) when the number of slabs is already no larger than > this minimum value. > > Signed-off-by: Jan Beulich Reviewed-by: Stefano Stabellini > --- a/drivers/xen/swiotlb-xen.c > +++ b/drivers/xen/swiotlb-xen.c > @@ -207,7 +207,7 @@ retry: > swiotlb_set_max_segment(PAGE_SIZE); > return 0; > error: > - if (repeat--) { > + if (nslabs > 1024 && repeat--) { > /* Min is 2MB */ > nslabs = max(1024UL, ALIGN(nslabs >> 1, IO_TLB_SEGSIZE)); > bytes = nslabs << IO_TLB_SHIFT; > @@ -243,7 +243,7 @@ retry: > rc = xen_swiotlb_fixup(start, nslabs); > if (rc) { > memblock_free(__pa(start), PAGE_ALIGN(bytes)); > - if (repeat--) { > + if (nslabs > 1024 && repeat--) { > /* Min is 2MB */ > nslabs = max(1024UL, ALIGN(nslabs >> 1, IO_TLB_SEGSIZE)); > bytes = nslabs << IO_TLB_SHIFT; >