Re: [bugzilla-daemon@xxxxxxxxxx: [Bug 219619] New: vfio-pci: screen graphics artifacts after 6.12 kernel upgrade]

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

 



On 31.12.24 17:07, Alex Williamson wrote:
Thank you so much for your testing, this is immensely helpful! This
all suggests to me we're dealing with an alignment issue for 1GB pages.
We're getting 2MB alignment on the mmap by default, so that's working
everywhere.  QEMU 9.2 provides us with proper 1GB alignment, but it
seems we need to filter alignment more strictly when that's not present.
Please give this a try with QEMU 9.1.x and an otherwise stock v6.12.x:

diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
index 1ab58da9f38a..bdfdc8ee4c2b 100644
--- a/drivers/vfio/pci/vfio_pci_core.c
+++ b/drivers/vfio/pci/vfio_pci_core.c
@@ -1661,7 +1661,8 @@ static vm_fault_t vfio_pci_mmap_huge_fault(struct vm_fault *vmf,
  	unsigned long pfn, pgoff = vmf->pgoff - vma->vm_pgoff;
  	vm_fault_t ret = VM_FAULT_SIGBUS;
- if (order && (vmf->address & ((PAGE_SIZE << order) - 1) ||
+	if (order && (pgoff & ((1 << order) - 1) ||
+		      vmf->address & ((PAGE_SIZE << order) - 1) ||
  		      vmf->address + (PAGE_SIZE << order) > vma->vm_end)) {
  		ret = VM_FAULT_FALLBACK;
  		goto out;


Thanks,
Alex


Thank you, that does the trick. In my tests with your patch, the order=18 huge_faults from QEMU 9.1.2 all fall back to order=9 (in one case, even with pgoff=0, likely from the vmf->address check), while those from QEMU 9.2.0 succeed as before. My Windows VM also is happy with the patched kernel 6.12.4 and QEMU 9.1.2 so far. For completeness' sake, here are the host logs with the patch applied, booting a Linux guest: https://bugzilla.kernel.org/show_bug.cgi?id=219619#c4

Thanks and Best wishes for the new year,
Precific




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux