Patch "PCI: hv: Fix ring buffer size calculation" has been added to the 6.8-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    PCI: hv: Fix ring buffer size calculation

to the 6.8-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     pci-hv-fix-ring-buffer-size-calculation.patch
and it can be found in the queue-6.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit c3b311af8e57d1084ad1c2711cb5c9ca19094604
Author: Michael Kelley <mhklinux@xxxxxxxxxxx>
Date:   Fri Feb 16 12:22:40 2024 -0800

    PCI: hv: Fix ring buffer size calculation
    
    [ Upstream commit b5ff74c1ef50fe08e384026875fec660fadfaedd ]
    
    For a physical PCI device that is passed through to a Hyper-V guest VM,
    current code specifies the VMBus ring buffer size as 4 pages.  But this
    is an inappropriate dependency, since the amount of ring buffer space
    needed is unrelated to PAGE_SIZE. For example, on x86 the ring buffer
    size ends up as 16 Kbytes, while on ARM64 with 64 Kbyte pages, the ring
    size bloats to 256 Kbytes. The ring buffer for PCI pass-thru devices
    is used for only a few messages during device setup and removal, so any
    space above a few Kbytes is wasted.
    
    Fix this by declaring the ring buffer size to be a fixed 16 Kbytes.
    Furthermore, use the VMBUS_RING_SIZE() macro so that the ring buffer
    header is properly accounted for, and so the size is rounded up to a
    page boundary, using the page size for which the kernel is built. While
    w/64 Kbyte pages this results in a 64 Kbyte ring buffer header plus a
    64 Kbyte ring buffer, that's the smallest possible with that page size.
    It's still 128 Kbytes better than the current code.
    
    Link: https://lore.kernel.org/linux-pci/20240216202240.251818-1-mhklinux@xxxxxxxxxxx
    Signed-off-by: Michael Kelley <mhklinux@xxxxxxxxxxx>
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@xxxxxxxxxx>
    Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@xxxxxxxxxxxxxxx>
    Reviewed-by: Ilpo Jarvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>
    Reviewed-by: Long Li <longli@xxxxxxxxxxxxx>
    Cc: <stable@xxxxxxxxxxxxxxx> # 5.15.x
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
index 1eaffff40b8d4..5992280e8110b 100644
--- a/drivers/pci/controller/pci-hyperv.c
+++ b/drivers/pci/controller/pci-hyperv.c
@@ -49,6 +49,7 @@
 #include <linux/refcount.h>
 #include <linux/irqdomain.h>
 #include <linux/acpi.h>
+#include <linux/sizes.h>
 #include <asm/mshyperv.h>
 
 /*
@@ -465,7 +466,7 @@ struct pci_eject_response {
 	u32 status;
 } __packed;
 
-static int pci_ring_size = (4 * PAGE_SIZE);
+static int pci_ring_size = VMBUS_RING_SIZE(SZ_16K);
 
 /*
  * Driver specific state.




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux