2021-09-07 12:08:43

by Jan Beulich

[permalink] [raw]
Subject: [PATCH 06/12] swiotlb-xen: limit init retries

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 <[email protected]>

--- 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;


2021-09-08 10:04:34

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH 06/12] swiotlb-xen: limit init retries

On Tue, Sep 07, 2021 at 02:06:37PM +0200, 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 <[email protected]>

Looks good,

Reviewed-by: Christoph Hellwig <[email protected]>

2021-09-10 23:25:49

by Stefano Stabellini

[permalink] [raw]
Subject: Re: [PATCH 06/12] swiotlb-xen: limit init retries

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 <[email protected]>

Reviewed-by: Stefano Stabellini <[email protected]>


> --- 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;
>