OSDN Git Service

swiotlb-xen: limit init retries
authorJan Beulich <jbeulich@suse.com>
Tue, 7 Sep 2021 12:06:37 +0000 (14:06 +0200)
committerJuergen Gross <jgross@suse.com>
Wed, 15 Sep 2021 06:42:04 +0000 (08:42 +0200)
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 <jbeulich@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/984fa426-2b7b-4b77-5ce8-766619575b7f@suse.com
Signed-off-by: Juergen Gross <jgross@suse.com>
drivers/xen/swiotlb-xen.c

index 6520d05..d30dc5e 100644 (file)
@@ -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;