Skip to contentSkip to conversation

vfio/pci-quirks: Set non-zero GMS memory size for IGD

PATCH In review Dmitry Fleytman 4 participants 9 messages Jul 24, 2017 – Aug 2, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vfio/pci-quirks: Set non-zero GMS memory size for IGD

There is a claim that GMS memory is unused however Intel Windows 10 drivers starting from V.4534 (10/7/2016) allocate extra ~4G memory when GMS size set to 0.

This patch fixes this issue by seting IGD GMS memory size to minimum by changing default value of x-igd-gms device parameter.

---
 hw/vfio/pci-quirks.c | 13 +++++++++----
 hw/vfio/pci.c        |  2 +-
 2 files changed, 10 insertions(+), 5 deletions(-)
hw/vfio/pci-quirks.c +9 -4
index 349085e..197cb90 100644
@@ -1527,10 +1527,15 @@ static void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr)
     }
 
     /*
-     * Assume we have no GMS memory, but allow it to be overrided by device
-     * option (experimental).  The spec doesn't actually allow zero GMS when
-     * when IVD (IGD VGA Disable) is clear, but the claim is that it's unused,
-     * so let's not waste VM memory for it.
+     * There is a claim that GMS memory is unused and we want to waste for it
+     * as less VM memory as possible, however Intel Windows 10 drivers starting
+     * from V.4534 (10/7/2016) allocate extra ~4G memory when GMS size set to 0.
+     * The spec as well doesn't actually allow zero GMS when IVD
+     * (IGD VGA Disable) is clear.
+     *
+     * Therefore we set GMS memory size to minimal by default via device
+     * option x-igd-gms (experimental) and allow further tweaking of this
+     * parameter.
      */
     gmch &= ~((gen < 8 ? 0x1f : 0xff) << (gen < 8 ? 3 : 8));
 
hw/vfio/pci.c +1 -1
index d4051cb..bda07b7 100644
@@ -2982,7 +2982,7 @@ static Property vfio_pci_dev_properties[] = {
                        sub_vendor_id, PCI_ANY_ID),
     DEFINE_PROP_UINT32("x-pci-sub-device-id", VFIOPCIDevice,
                        sub_device_id, PCI_ANY_ID),
-    DEFINE_PROP_UINT32("x-igd-gms", VFIOPCIDevice, igd_gms, 0),
+    DEFINE_PROP_UINT32("x-igd-gms", VFIOPCIDevice, igd_gms, 1),
     /*
      * TODO - support passed fds... is this necessary?
      * DEFINE_PROP_STRING("vfiofd", VFIOPCIDevice, vfiofd_name),
Signature · 1 line
2.9.4
#1 lore raw

Just noticed a small typo, other than LGTM +1 :)

Quoted 6 lines · Dmitry Fleytman

There is a claim that GMS memory is unused however Intel Windows 10 drivers starting from V.4534 (10/7/2016) allocate extra ~4G memory when GMS size set to 0.

This patch fixes this issue by seting IGD GMS memory

* setting

Quoted 58 lines

size to minimum by changing default value of x-igd-gms device parameter.

---
 hw/vfio/pci-quirks.c | 13 +++++++++----
 hw/vfio/pci.c        |  2 +-
 2 files changed, 10 insertions(+), 5 deletions(-)
hw/vfio/pci-quirks.c +0 -1
index 349085e..197cb90 100644
@@ -1527,10 +1527,15 @@ static void vfio_probe_igd_bar4_quirk(VFIOPCIDevice
 *vdev, int nr)
     }
 
     /*
-     * Assume we have no GMS memory, but allow it to be overrided by

device
- * option (experimental). The spec doesn't actually allow zero GMS
when
- * when IVD (IGD VGA Disable) is clear, but the claim is that it's
unused,

hw/vfio/pci-quirks.c +1 -1
-     * so let's not waste VM memory for it.
+     * There is a claim that GMS memory is unused and we want to waste

for it
+ * as less VM memory as possible, however Intel Windows 10 drivers
starting
+ * from V.4534 (10/7/2016) allocate extra ~4G memory when GMS size
set to 0.

hw/vfio/pci-quirks.c +6 -0
+     * The spec as well doesn't actually allow zero GMS when IVD
+     * (IGD VGA Disable) is clear.
+     *
+     * Therefore we set GMS memory size to minimal by default via device
+     * option x-igd-gms (experimental) and allow further tweaking of this
+     * parameter.
      */
     gmch &= ~((gen < 8 ? 0x1f : 0xff) << (gen < 8 ? 3 : 8));
hw/vfio/pci.c +1 -2
index d4051cb..bda07b7 100644
@@ -2982,7 +2982,7 @@ static Property vfio_pci_dev_properties[] = {
                        sub_vendor_id, PCI_ANY_ID),
     DEFINE_PROP_UINT32("x-pci-sub-device-id", VFIOPCIDevice,
                        sub_device_id, PCI_ANY_ID),
-    DEFINE_PROP_UINT32("x-igd-gms", VFIOPCIDevice, igd_gms, 0),
+    DEFINE_PROP_UINT32("x-igd-gms", VFIOPCIDevice, igd_gms, 1),
     /*
      * TODO - support passed fds... is this necessary?
      * DEFINE_PROP_STRING("vfiofd", VFIOPCIDevice, vfiofd_name),
--

2.9.4

Signature · 4 lines
Respectfully,
*Sameeh Jubran*
*Linkedin <https://il.linkedin.com/pub/sameeh-jubran/87/747/a8a>*
*Software Engineer @ Daynix <http://www.daynix.com>.*
#2 lore raw
In reply to Dmitry Fleytman

[cc +Zhang, Xiong Y]

Intel, any comments?

Quoted 51 lines · On Mon, 24 Jul 2017 15:07:29 +0300 Dmitry Fleytman <[email protected]> wrote:

There is a claim that GMS memory is unused however Intel Windows 10 drivers starting from V.4534 (10/7/2016) allocate extra ~4G memory when GMS size set to 0.

This patch fixes this issue by seting IGD GMS memory size to minimum by changing default value of x-igd-gms device parameter.

---
 hw/vfio/pci-quirks.c | 13 +++++++++----
 hw/vfio/pci.c        |  2 +-
 2 files changed, 10 insertions(+), 5 deletions(-)
hw/vfio/pci-quirks.c +9 -4
index 349085e..197cb90 100644
@@ -1527,10 +1527,15 @@ static void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr)
     }
 
     /*
-     * Assume we have no GMS memory, but allow it to be overrided by device
-     * option (experimental).  The spec doesn't actually allow zero GMS when
-     * when IVD (IGD VGA Disable) is clear, but the claim is that it's unused,
-     * so let's not waste VM memory for it.
+     * There is a claim that GMS memory is unused and we want to waste for it
+     * as less VM memory as possible, however Intel Windows 10 drivers starting
+     * from V.4534 (10/7/2016) allocate extra ~4G memory when GMS size set to 0.
+     * The spec as well doesn't actually allow zero GMS when IVD
+     * (IGD VGA Disable) is clear.
+     *
+     * Therefore we set GMS memory size to minimal by default via device
+     * option x-igd-gms (experimental) and allow further tweaking of this
+     * parameter.
      */
     gmch &= ~((gen < 8 ? 0x1f : 0xff) << (gen < 8 ? 3 : 8));
 
hw/vfio/pci.c +1 -1
index d4051cb..bda07b7 100644
@@ -2982,7 +2982,7 @@ static Property vfio_pci_dev_properties[] = {
                        sub_vendor_id, PCI_ANY_ID),
     DEFINE_PROP_UINT32("x-pci-sub-device-id", VFIOPCIDevice,
                        sub_device_id, PCI_ANY_ID),
-    DEFINE_PROP_UINT32("x-igd-gms", VFIOPCIDevice, igd_gms, 0),
+    DEFINE_PROP_UINT32("x-igd-gms", VFIOPCIDevice, igd_gms, 1),
     /*
      * TODO - support passed fds... is this necessary?
      * DEFINE_PROP_STRING("vfiofd", VFIOPCIDevice, vfiofd_name),
#3 lore raw

Sorry, we indeed found Intel windows guest graphic driver couldn't be bind when GMS memory size is zero. And we have fixed it and the next intel windows driver release will contain this fix. So currently please use x-igd-gms in legacy mode to work around this.

BTW, how did you know window driver allocate extra ~4G memory when GMS size set to 0 ?

thanks

Quoted 73 lines

-----Original Message-----
From: Alex Williamson [mailto:[email protected]]
Sent: Tuesday, July 25, 2017 11:32 PM
To: Dmitry Fleytman <[email protected]>
Cc: [email protected]; Zhang, Xiong Y <[email protected]>
Subject: Re: [PATCH] vfio/pci-quirks: Set non-zero GMS memory size for IGD

[cc +Zhang, Xiong Y]

Intel, any comments?

hw/vfio/pci-quirks.c static void

Quoted 19 lines · On Mon, 24 Jul 2017 15:07:29 +0300 Dmitry Fleytman <[email protected]> wrote:

There is a claim that GMS memory is unused however Intel Windows 10 drivers starting from V.4534 (10/7/2016) allocate extra ~4G memory when GMS size set to 0.

This patch fixes this issue by seting IGD GMS memory size to minimum by changing default value of x-igd-gms device parameter.

---
 hw/vfio/pci-quirks.c | 13 +++++++++----
 hw/vfio/pci.c        |  2 +-
 2 files changed, 10 insertions(+), 5 deletions(-)
hw/vfio/pci-quirks.c +0 -0
index 349085e..197cb90 100644
@@ -1527,10 +1527,15 @@ static void

vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr)

hw/vfio/pci-quirks.c static void · line 1530

Quoted 4 lines
hw/vfio/pci-quirks.c +0 -1
     }
 
     /*
-     * Assume we have no GMS memory, but allow it to be overrided by

device

hw/vfio/pci-quirks.c static void · line 1531

Quoted 1 line
hw/vfio/pci-quirks.c +0 -1
-     * option (experimental).  The spec doesn't actually allow zero GMS

when

hw/vfio/pci-quirks.c static void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr)

Quoted 3 lines
hw/vfio/pci-quirks.c +1 -2
-     * when IVD (IGD VGA Disable) is clear, but the claim is that it's unused,
-     * so let's not waste VM memory for it.
+     * There is a claim that GMS memory is unused and we want to waste

for it

hw/vfio/pci-quirks.c static void · line 1531

Quoted 1 line
hw/vfio/pci-quirks.c +1 -0
+     * as less VM memory as possible, however Intel Windows 10 drivers

starting

hw/vfio/pci-quirks.c static void · line 1532

Quoted 1 line
hw/vfio/pci-quirks.c +1 -0
+     * from V.4534 (10/7/2016) allocate extra ~4G memory when GMS

size set to 0.

Quoted 22 lines
hw/vfio/pci-quirks.c +6 -0
+     * The spec as well doesn't actually allow zero GMS when IVD
+     * (IGD VGA Disable) is clear.
+     *
+     * Therefore we set GMS memory size to minimal by default via device
+     * option x-igd-gms (experimental) and allow further tweaking of this
+     * parameter.
      */
     gmch &= ~((gen < 8 ? 0x1f : 0xff) << (gen < 8 ? 3 : 8));
 
hw/vfio/pci.c +1 -1
index d4051cb..bda07b7 100644
@@ -2982,7 +2982,7 @@ static Property vfio_pci_dev_properties[] = {
                        sub_vendor_id, PCI_ANY_ID),
     DEFINE_PROP_UINT32("x-pci-sub-device-id", VFIOPCIDevice,
                        sub_device_id, PCI_ANY_ID),
-    DEFINE_PROP_UINT32("x-igd-gms", VFIOPCIDevice, igd_gms, 0),
+    DEFINE_PROP_UINT32("x-igd-gms", VFIOPCIDevice, igd_gms, 1),
     /*
      * TODO - support passed fds... is this necessary?
      * DEFINE_PROP_STRING("vfiofd", VFIOPCIDevice, vfiofd_name),
#4 lore raw
Quoted 7 lines · Xiong Y

Sorry, we indeed found Intel windows guest graphic driver couldn't be bind when GMS memory size is zero. And we have fixed it and the next intel windows driver release will contain this fix. So currently please use x-igd-gms in legacy mode to work around this.

BTW, how did you know window driver allocate extra ~4G memory when GMS size set to 0 ?

We noticed that with new IGD driver memory usage on VMs raised by around 4G.

Then we examined memory allocations with poolmon (https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/poolmon)
and saw that around 4G of memory is allocated with IGD driver pool tag.

Additionally we noticed that on VMs with less than 5G of memory IGD driver does not load and system does fallback to standard VGA driver.

Quoted 76 lines

thanks

Quoted 73 lines

-----Original Message-----
From: Alex Williamson [mailto:[email protected]]
Sent: Tuesday, July 25, 2017 11:32 PM
To: Dmitry Fleytman <[email protected]>
Cc: [email protected]; Zhang, Xiong Y <[email protected]>
Subject: Re: [PATCH] vfio/pci-quirks: Set non-zero GMS memory size for IGD

[cc +Zhang, Xiong Y]

Intel, any comments?

hw/vfio/pci-quirks.c static void

Quoted 19 lines · On Mon, 24 Jul 2017 15:07:29 +0300 Dmitry Fleytman <[email protected]> wrote:

There is a claim that GMS memory is unused however Intel Windows 10 drivers starting from V.4534 (10/7/2016) allocate extra ~4G memory when GMS size set to 0.

This patch fixes this issue by seting IGD GMS memory size to minimum by changing default value of x-igd-gms device parameter.

---
hw/vfio/pci-quirks.c | 13 +++++++++----
hw/vfio/pci.c | 2 +-

2 files changed, 10 insertions(+), 5 deletions(-)
hw/vfio/pci-quirks.c +0 -0
index 349085e..197cb90 100644
@@ -1527,10 +1527,15 @@ static void

vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr)

hw/vfio/pci-quirks.c static void · line 1530

Quoted 4 lines
hw/vfio/pci-quirks.c +0 -1
    }
 
    /*
-     * Assume we have no GMS memory, but allow it to be overrided by

device

hw/vfio/pci-quirks.c static void · line 1531

Quoted 1 line
hw/vfio/pci-quirks.c +0 -1
-     * option (experimental).  The spec doesn't actually allow zero GMS

when

hw/vfio/pci-quirks.c static void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr)

Quoted 3 lines
hw/vfio/pci-quirks.c +1 -2
-     * when IVD (IGD VGA Disable) is clear, but the claim is that it's unused,
-     * so let's not waste VM memory for it.
+     * There is a claim that GMS memory is unused and we want to waste

for it

hw/vfio/pci-quirks.c static void · line 1531

Quoted 1 line
hw/vfio/pci-quirks.c +1 -0
+     * as less VM memory as possible, however Intel Windows 10 drivers

starting

hw/vfio/pci-quirks.c static void · line 1532

Quoted 1 line
hw/vfio/pci-quirks.c +1 -0
+     * from V.4534 (10/7/2016) allocate extra ~4G memory when GMS

size set to 0.

Quoted 22 lines
hw/vfio/pci-quirks.c +6 -0
+     * The spec as well doesn't actually allow zero GMS when IVD
+     * (IGD VGA Disable) is clear.
+     *
+     * Therefore we set GMS memory size to minimal by default via device
+     * option x-igd-gms (experimental) and allow further tweaking of this
+     * parameter.
     */
    gmch &= ~((gen < 8 ? 0x1f : 0xff) << (gen < 8 ? 3 : 8));
 
hw/vfio/pci.c +1 -1
index d4051cb..bda07b7 100644
@@ -2982,7 +2982,7 @@ static Property vfio_pci_dev_properties[] = {
                       sub_vendor_id, PCI_ANY_ID),
    DEFINE_PROP_UINT32("x-pci-sub-device-id", VFIOPCIDevice,
                       sub_device_id, PCI_ANY_ID),
-    DEFINE_PROP_UINT32("x-igd-gms", VFIOPCIDevice, igd_gms, 0),
+    DEFINE_PROP_UINT32("x-igd-gms", VFIOPCIDevice, igd_gms, 1),
    /*
     * TODO - support passed fds... is this necessary?
     * DEFINE_PROP_STRING("vfiofd", VFIOPCIDevice, vfiofd_name),
#5 lore raw
Quoted 14 lines
Quoted 1 line

On 26 Jul 2017, at 08:22 AM, Zhang, Xiong Y <[email protected]>

Quoted 2 lines · wrote:

Sorry, we indeed found Intel windows guest graphic driver couldn't be bind

when GMS memory size is zero. And we have fixed it and the next intel windows driver release will contain this fix.

Quoted 3 lines

So currently please use x-igd-gms in legacy mode to work around this.

BTW, how did you know window driver allocate extra ~4G memory when

GMS size set to 0 ?

We noticed that with new IGD driver memory usage on VMs raised by around 4G.

Quoted 7 lines

Then we examined memory allocations with poolmon
(https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/poolm
on)
and saw that around 4G of memory is allocated with IGD driver pool tag. Additionally we noticed that on VMs with less than 5G of memory IGD driver does not load and system does fallback to standard VGA driver.

[Zhang, Xiong Y] I tried our internal driver and didn't found the above two issues, please wait for the next intel graphic driver release.

thanks

#6 lore raw
Quoted 17 lines · Xiong Y
Quoted 15 lines
Quoted 2 lines

On 26 Jul 2017, at 08:22 AM, Zhang, Xiong Y <[email protected]>

Quoted 2 lines · wrote:

Sorry, we indeed found Intel windows guest graphic driver couldn't be bind

when GMS memory size is zero. And we have fixed it and the next intel windows driver release will contain this fix.

Quoted 3 lines

So currently please use x-igd-gms in legacy mode to work around this.

BTW, how did you know window driver allocate extra ~4G memory when

GMS size set to 0 ?

We noticed that with new IGD driver memory usage on VMs raised by around 4G.

Quoted 8 lines
Quoted 7 lines

Then we examined memory allocations with poolmon
(https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/poolm
on)
and saw that around 4G of memory is allocated with IGD driver pool tag. Additionally we noticed that on VMs with less than 5G of memory IGD driver does not load and system does fallback to standard VGA driver.

[Zhang, Xiong Y] I tried our internal driver and didn't found the above two issues, please wait for the next intel graphic driver release.

Thanks!

Quoted 2 lines

thanks

#7 lore raw
Quoted 23 lines · On Fri, 28 Jul 2017 08:22:45 +0300 Dmitry Fleytman <[email protected]> wrote:
Quoted 23 lines · Xiong Y
Quoted 22 lines
Quoted 2 lines

On 26 Jul 2017, at 08:22 AM, Zhang, Xiong Y <[email protected]>

Quoted 2 lines · wrote:

Sorry, we indeed found Intel windows guest graphic driver couldn't be bind

when GMS memory size is zero. And we have fixed it and the next intel windows driver release will contain this fix.

Quoted 3 lines

So currently please use x-igd-gms in legacy mode to work around this.

BTW, how did you know window driver allocate extra ~4G memory when

GMS size set to 0 ?

We noticed that with new IGD driver memory usage on VMs raised by around 4G.

Then we examined memory allocations with poolmon
(https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/poolm
on)
and saw that around 4G of memory is allocated with IGD driver pool tag. Additionally we noticed that on VMs with less than 5G of memory IGD driver does not load and system does fallback to standard VGA driver.

Quoted 3 lines
Quoted 1 line

[Zhang, Xiong Y] I tried our internal driver and didn't found the above two issues, please wait for the next intel graphic driver release.

Thanks!

So to close on this, we should just be recommending that users encountering this problem add the x-igd-gms=1 option to the device until the next Intel graphics release. I won't plan to push this change. Thanks all,

Alex

#8 lore raw
Quoted 29 lines · Alex Williamson
Quoted 23 lines · On Fri, 28 Jul 2017 08:22:45 +0300 Dmitry Fleytman <[email protected]…
Quoted 23 lines · Xiong Y
Quoted 22 lines
Quoted 2 lines

On 26 Jul 2017, at 08:22 AM, Zhang, Xiong Y <[email protected]>

Quoted 2 lines · wrote:

Sorry, we indeed found Intel windows guest graphic driver couldn't be bind

when GMS memory size is zero. And we have fixed it and the next intel windows driver release will contain this fix.

Quoted 3 lines

So currently please use x-igd-gms in legacy mode to work around this.

BTW, how did you know window driver allocate extra ~4G memory when

GMS size set to 0 ?

We noticed that with new IGD driver memory usage on VMs raised by around 4G.

Then we examined memory allocations with poolmon
(https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/poolm
on)
and saw that around 4G of memory is allocated with IGD driver pool tag. Additionally we noticed that on VMs with less than 5G of memory IGD driver does not load and system does fallback to standard VGA driver.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

[Zhang, Xiong Y] I tried our internal driver and didn't found the above two issues, please wait for the next intel graphic driver release.

Thanks!

So to close on this, we should just be recommending that users encountering this problem add the x-igd-gms=1 option to the device until the next Intel graphics release. I won't plan to push this change. Thanks all,

Hi Alex,

Agree, that makes sense.

Thanks you,
Dmitry

Quoted 2 lines

Alex