Skip to contentSkip to conversation

drm/i915: prevent generating unusable gvt build which no mpt module is selected

PATCH In review [email protected] 5 participants 9 messages May 24, 2017 – May 26, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: prevent generating unusable gvt build which no mpt module is selected

From: Changbin Du <[email protected]>

At least we need one MPT module (currently only have one) selected to get GVTg functional. When GVTg is enabled while no MPT selected, the build just includes useless GVTg code. This doesn't make sense.

With this patch, a submenut is created under i915 as below:
-*- Enable Intel GVT-g graphics virtualization host support <M> Enable KVM/VFIO support for Intel GVT-g

If no MPT is selected, GVTg will be disabled automatically.
< > Enable KVM/VFIO support for Intel GVT-g

---
 drivers/gpu/drm/i915/Kconfig | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/Kconfig +10 -6
index a5cd5da..e380a5d 100644
@@ -91,12 +91,15 @@ config DRM_I915_USERPTR
 
 	  If in doubt, say "Y".
 
+menu "Intel GVT-g graphics virtualization host support"
+	depends on DRM_I915
+	depends on 64BIT
+
 config DRM_I915_GVT
-        bool "Enable Intel GVT-g graphics virtualization host support"
-        depends on DRM_I915
-        depends on 64BIT
-        default n
-        help
+	bool "Enable Intel GVT-g graphics virtualization host support"
+	default n
+	depends on DRM_I915_GVT_KVMGT
+	help
 	  Choose this option if you want to enable Intel GVT-g graphics
 	  virtualization technology host support with integrated graphics.
 	  With GVT-g, it's possible to have one integrated graphics
@@ -116,13 +119,14 @@ config DRM_I915_GVT
 
 config DRM_I915_GVT_KVMGT
 	tristate "Enable KVM/VFIO support for Intel GVT-g"
-	depends on DRM_I915_GVT
+	select DRM_I915_GVT
 	depends on KVM
 	depends on VFIO_MDEV && VFIO_MDEV_DEVICE
 	default n
 	help
 	  Choose this option if you want to enable KVMGT support for
 	  Intel GVT-g.
+endmenu
 
 menu "drm/i915 Debugging"
 depends on DRM_I915
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 6 lines · On 2017.05.24 16:50:39 +0800, [email protected] wrote:

From: Changbin Du <[email protected]>

At least we need one MPT module (currently only have one) selected to get GVTg functional. When GVTg is enabled while no MPT selected, the build just includes useless GVTg code. This doesn't make sense.

The reason was that we tried to merge gvt device model in upstream first while finishing KVMGT part later. I'm ok with this now.

Quoted 56 lines

With this patch, a submenut is created under i915 as below:
-*- Enable Intel GVT-g graphics virtualization host support <M> Enable KVM/VFIO support for Intel GVT-g

If no MPT is selected, GVTg will be disabled automatically.
< > Enable KVM/VFIO support for Intel GVT-g

---
 drivers/gpu/drm/i915/Kconfig | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/Kconfig +10 -6
index a5cd5da..e380a5d 100644
@@ -91,12 +91,15 @@ config DRM_I915_USERPTR
 
 	  If in doubt, say "Y".
 
+menu "Intel GVT-g graphics virtualization host support"
+	depends on DRM_I915
+	depends on 64BIT
+
 config DRM_I915_GVT
-        bool "Enable Intel GVT-g graphics virtualization host support"
-        depends on DRM_I915
-        depends on 64BIT
-        default n
-        help
+	bool "Enable Intel GVT-g graphics virtualization host support"
+	default n
+	depends on DRM_I915_GVT_KVMGT
+	help
 	  Choose this option if you want to enable Intel GVT-g graphics
 	  virtualization technology host support with integrated graphics.
 	  With GVT-g, it's possible to have one integrated graphics
@@ -116,13 +119,14 @@ config DRM_I915_GVT
 
 config DRM_I915_GVT_KVMGT
 	tristate "Enable KVM/VFIO support for Intel GVT-g"
-	depends on DRM_I915_GVT
+	select DRM_I915_GVT
 	depends on KVM
 	depends on VFIO_MDEV && VFIO_MDEV_DEVICE
 	default n
 	help
 	  Choose this option if you want to enable KVMGT support for
 	  Intel GVT-g.
+endmenu
 
 menu "drm/i915 Debugging"
 depends on DRM_I915
Signature · 1 line
2.7.4
Signature · 3 lines
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw
In reply to [email protected]
Quoted 5 lines · On Wed, May 24, 2017 at 04:50:39PM +0800, [email protected] wrote:

From: Changbin Du <[email protected]>

At least we need one MPT module (currently only have one) selected to get GVTg functional. When GVTg is enabled while no MPT selected, the build just includes useless GVTg code. This doesn't make sense.

See the Kconfig "choice" directive.
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
Quoted 10 lines · Chris Wilson
Quoted 5 lines · On Wed, May 24, 2017 at 04:50:39PM +0800, [email protected] wrote:

From: Changbin Du <[email protected]>

At least we need one MPT module (currently only have one) selected to get GVTg functional. When GVTg is enabled while no MPT selected, the build just includes useless GVTg code. This doesn't make sense.

See the Kconfig "choice" directive.
-Chris

I was thought about "choice" as in mind firstly and that is good. But I think this is better since it make it totaly impossible that GVT is enabled while no MPT. With "choice", if we forget disable GVT after unselect all MPTs, we still compile GVT in but will never not use it.

Quoted 6 lines
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
intel-gvt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev
Signature · 2 lines
Thanks,
Changbin Du

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

✓ Fi.CI.BAT: success for drm/i915: prevent generating unusable gvt build which no mpt module is selected

In reply to [email protected]
== Series Details ==

== Series Details ==

Series: drm/i915: prevent generating unusable gvt build which no mpt module is selected
URL : https://patchwork.freedesktop.org/series/24866/
State : success

== Summary ==

Series 24866v1 drm/i915: prevent generating unusable gvt build which no mpt module is selected
https://patchwork.freedesktop.org/api/1.0/series/24866/revisions/1/mbox/

Test gem_exec_flush:

        Subgroup basic-batch-kernel-default-uc:
                pass       -> FAIL       (fi-snb-2600) fdo#100007
Test gem_exec_suspend:
        Subgroup basic-s4-devices:
                dmesg-warn -> PASS       (fi-snb-2600) fdo#100125

fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007
fdo#100125 https://bugs.freedesktop.org/show_bug.cgi?id=100125

fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time:438s
fi-bdw-gvtdvm    total:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  time:433s
fi-bsw-n3050     total:278  pass:242  dwarn:0   dfail:0   fail:0   skip:36  time:574s
fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time:508s
fi-byt-j1900     total:278  pass:254  dwarn:0   dfail:0   fail:0   skip:24  time:490s
fi-byt-n2820     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:479s
fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:414s
fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:412s
fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time:421s
fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:494s
fi-ivb-3770      total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:460s
fi-kbl-7500u     total:278  pass:255  dwarn:5   dfail:0   fail:0   skip:18  time:461s
fi-kbl-7560u     total:278  pass:263  dwarn:5   dfail:0   fail:0   skip:10  time:569s
fi-skl-6260u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:462s
fi-skl-6700hq    total:278  pass:239  dwarn:0   dfail:1   fail:17  skip:21  time:429s
fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time:471s
fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:505s
fi-skl-gvtdvm    total:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  time:436s
fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:530s
fi-snb-2600      total:278  pass:248  dwarn:0   dfail:0   fail:1   skip:29  time:409s

c8f2238b9cbfef358e61596cd49b1f648c85811e drm-tip: 2017y-05m-24d-08h-04m-41s UTC integration manifest 532fa01 drm/i915: prevent generating unusable gvt build which no mpt module is selected

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4798/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

maintainer
#5 lore raw
In reply to [email protected]
Quoted 30 lines · On Wed, 24 May 2017, [email protected] wrote:

From: Changbin Du <[email protected]>

At least we need one MPT module (currently only have one) selected to get GVTg functional. When GVTg is enabled while no MPT selected, the build just includes useless GVTg code. This doesn't make sense.

With this patch, a submenut is created under i915 as below:
-*- Enable Intel GVT-g graphics virtualization host support <M> Enable KVM/VFIO support for Intel GVT-g

If no MPT is selected, GVTg will be disabled automatically.
< > Enable KVM/VFIO support for Intel GVT-g

---
 drivers/gpu/drm/i915/Kconfig | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/Kconfig +4 -0
index a5cd5da..e380a5d 100644
@@ -91,12 +91,15 @@ config DRM_I915_USERPTR
 
 	  If in doubt, say "Y".
 
+menu "Intel GVT-g graphics virtualization host support"
+	depends on DRM_I915
+	depends on 64BIT
+

drivers/gpu/drm/i915/Kconfig config DRM_I915_USERPTR · line 102

Quoted 10 lines
drivers/gpu/drm/i915/Kconfig +4 -5
 config DRM_I915_GVT
-        bool "Enable Intel GVT-g graphics virtualization host support"
-        depends on DRM_I915
-        depends on 64BIT
-        default n
-        help
+	bool "Enable Intel GVT-g graphics virtualization host support"
+	default n
+	depends on DRM_I915_GVT_KVMGT
+	help

With this change, you can't actually change this config option. It's purely subject to CONFIG_DRM_I915_GVT_KVMGT. You need to enable KVMGT to even see this option, but enabling it will enable this one too. You can't disable this before you disable KVMGT, but then disabling KVMGT will disable this one too. This config option becomes pointless as a visible option. Which isn't all that bad, considering Documentation/kbuild/kconfig-language.txt:

Note:
select should be used with care. select will force a symbol to a value without visiting the dependencies. By abusing select you are able to select a symbol FOO even if FOO depends on BAR that is not set.
In general use select only for non-visible symbols (no prompts anywhere) and for symbols with no dependencies. That will limit the usefulness but on the other hand avoid the illegal configurations all over.

BR,
Jani.

Quoted 19 lines
drivers/gpu/drm/i915/Kconfig +2 -1
 	  Choose this option if you want to enable Intel GVT-g graphics
 	  virtualization technology host support with integrated graphics.
 	  With GVT-g, it's possible to have one integrated graphics
@@ -116,13 +119,14 @@ config DRM_I915_GVT
 
 config DRM_I915_GVT_KVMGT
 	tristate "Enable KVM/VFIO support for Intel GVT-g"
-	depends on DRM_I915_GVT
+	select DRM_I915_GVT
 	depends on KVM
 	depends on VFIO_MDEV && VFIO_MDEV_DEVICE
 	default n
 	help
 	  Choose this option if you want to enable KVMGT support for
 	  Intel GVT-g.
+endmenu
 
 menu "drm/i915 Debugging"
 depends on DRM_I915
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

Hi, Jani, just relized you are in i915 team. :)

Quoted 15 lines
Quoted 4 lines
drivers/gpu/drm/i915/Kconfig +4 -0
+menu "Intel GVT-g graphics virtualization host support"
+	depends on DRM_I915
+	depends on 64BIT
+

drivers/gpu/drm/i915/Kconfig config DRM_I915_USERPTR · line 102

Quoted 10 lines
drivers/gpu/drm/i915/Kconfig +4 -5
 config DRM_I915_GVT
-        bool "Enable Intel GVT-g graphics virtualization host support"
-        depends on DRM_I915
-        depends on 64BIT
-        default n
-        help
+	bool "Enable Intel GVT-g graphics virtualization host support"
+	default n
+	depends on DRM_I915_GVT_KVMGT
+	help
Quoted 8 lines

With this change, you can't actually change this config option. It's purely subject to CONFIG_DRM_I915_GVT_KVMGT. You need to enable KVMGT to even see this option, but enabling it will enable this one too. You can't disable this before you disable KVMGT, but then disabling KVMGT will disable this one too. This config option becomes pointless as a visible option. Which isn't all that bad, considering Documentation/kbuild/kconfig-language.txt:

Jani, this is by design in this patch. We will add another xengt hypervisor glue layer to support XenGT. After that, enable DRM_I915_GVT only if at least one of KVMGT or XENGT enabled or both. Also it doesn't make sense that we only build KVMGT/XenGT module without DRM_I915_GVT.

Such mechanism is not as straigforward as two simple 'choice', so I agree with 'choice' if you prefer it. As you said, it is not a big problem.

Quoted 10 lines

Note:
select should be used with care. select will force a symbol to a value without visiting the dependencies. By abusing select you are able to select a symbol FOO even if FOO depends on BAR that is not set.
In general use select only for non-visible symbols (no prompts anywhere) and for symbols with no dependencies. That will limit the usefulness but on the other hand avoid the illegal configurations all over.

Yes, we should always be carefull with 'select' and should not use it if possible. So here I must create a 'menu' to ensure its safety.

Quoted 29 lines

BR,
Jani.

Quoted 19 lines
drivers/gpu/drm/i915/Kconfig +2 -1
 	  Choose this option if you want to enable Intel GVT-g graphics
 	  virtualization technology host support with integrated graphics.
 	  With GVT-g, it's possible to have one integrated graphics
@@ -116,13 +119,14 @@ config DRM_I915_GVT
 
 config DRM_I915_GVT_KVMGT
 	tristate "Enable KVM/VFIO support for Intel GVT-g"
-	depends on DRM_I915_GVT
+	select DRM_I915_GVT
 	depends on KVM
 	depends on VFIO_MDEV && VFIO_MDEV_DEVICE
 	default n
 	help
 	  Choose this option if you want to enable KVMGT support for
 	  Intel GVT-g.
+endmenu
 
 menu "drm/i915 Debugging"
 depends on DRM_I915
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
intel-gvt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev
Signature · 2 lines
Thanks,
Changbin Du

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

maintainer
#7 lore raw
Quoted 43 lines · Changbin

Hi, Jani, just relized you are in i915 team. :)

Quoted 15 lines
Quoted 4 lines
drivers/gpu/drm/i915/Kconfig +4 -0
+menu "Intel GVT-g graphics virtualization host support"
+	depends on DRM_I915
+	depends on 64BIT
+

drivers/gpu/drm/i915/Kconfig config DRM_I915_USERPTR · line 102

Quoted 10 lines
drivers/gpu/drm/i915/Kconfig +4 -5
 config DRM_I915_GVT
-        bool "Enable Intel GVT-g graphics virtualization host support"
-        depends on DRM_I915
-        depends on 64BIT
-        default n
-        help
+	bool "Enable Intel GVT-g graphics virtualization host support"
+	default n
+	depends on DRM_I915_GVT_KVMGT
+	help
Quoted 8 lines

With this change, you can't actually change this config option. It's purely subject to CONFIG_DRM_I915_GVT_KVMGT. You need to enable KVMGT to even see this option, but enabling it will enable this one too. You can't disable this before you disable KVMGT, but then disabling KVMGT will disable this one too. This config option becomes pointless as a visible option. Which isn't all that bad, considering Documentation/kbuild/kconfig-language.txt:

Jani, this is by design in this patch. We will add another xengt hypervisor glue layer to support XenGT. After that, enable DRM_I915_GVT only if at least one of KVMGT or XENGT enabled or both. Also it doesn't make sense that we only build KVMGT/XenGT module without DRM_I915_GVT.

Such mechanism is not as straigforward as two simple 'choice', so I agree with 'choice' if you prefer it. As you said, it is not a big problem.

Quoted 10 lines

Note:
select should be used with care. select will force a symbol to a value without visiting the dependencies. By abusing select you are able to select a symbol FOO even if FOO depends on BAR that is not set.
In general use select only for non-visible symbols (no prompts anywhere) and for symbols with no dependencies. That will limit the usefulness but on the other hand avoid the illegal configurations all over.

Quoted 2 lines

Yes, we should always be carefull with 'select' and should not use it if possible. So here I must create a 'menu' to ensure its safety.

I'm trying to say, why do you make DRM_I915_GVT visible in menuconfig at all when you can't actually change it in menuconfig?

BR,
Jani.

Quoted 30 lines
Quoted 30 lines

BR,
Jani.

Quoted 19 lines
drivers/gpu/drm/i915/Kconfig +2 -1
 	  Choose this option if you want to enable Intel GVT-g graphics
 	  virtualization technology host support with integrated graphics.
 	  With GVT-g, it's possible to have one integrated graphics
@@ -116,13 +119,14 @@ config DRM_I915_GVT
 
 config DRM_I915_GVT_KVMGT
 	tristate "Enable KVM/VFIO support for Intel GVT-g"
-	depends on DRM_I915_GVT
+	select DRM_I915_GVT
 	depends on KVM
 	depends on VFIO_MDEV && VFIO_MDEV_DEVICE
 	default n
 	help
 	  Choose this option if you want to enable KVMGT support for
 	  Intel GVT-g.
+endmenu
 
 menu "drm/i915 Debugging"
 depends on DRM_I915
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
intel-gvt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw
Quoted 11 lines · Jani Nikula
Quoted 10 lines · Changbin
Quoted 10 lines

Note:
select should be used with care. select will force a symbol to a value without visiting the dependencies. By abusing select you are able to select a symbol FOO even if FOO depends on BAR that is not set.
In general use select only for non-visible symbols (no prompts anywhere) and for symbols with no dependencies. That will limit the usefulness but on the other hand avoid the illegal configurations all over.

Quoted 6 lines
Quoted 2 lines

Yes, we should always be carefull with 'select' and should not use it if possible. So here I must create a 'menu' to ensure its safety.

I'm trying to say, why do you make DRM_I915_GVT visible in menuconfig at all when you can't actually change it in menuconfig?

ok, that is to info the user that GVT is enabled, since DRM_I915_GVT apply to seperated i915 module. I saw similar behaviour in some driver, but cannot recall its name now...

Quoted 38 lines

BR,
Jani.

Quoted 30 lines
Quoted 30 lines

BR,
Jani.

Quoted 19 lines
drivers/gpu/drm/i915/Kconfig +2 -1
 	  Choose this option if you want to enable Intel GVT-g graphics
 	  virtualization technology host support with integrated graphics.
 	  With GVT-g, it's possible to have one integrated graphics
@@ -116,13 +119,14 @@ config DRM_I915_GVT
 
 config DRM_I915_GVT_KVMGT
 	tristate "Enable KVM/VFIO support for Intel GVT-g"
-	depends on DRM_I915_GVT
+	select DRM_I915_GVT
 	depends on KVM
 	depends on VFIO_MDEV && VFIO_MDEV_DEVICE
 	default n
 	help
 	  Choose this option if you want to enable KVMGT support for
 	  Intel GVT-g.
+endmenu
 
 menu "drm/i915 Debugging"
 depends on DRM_I915
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
intel-gvt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Signature · 2 lines
Thanks,
Changbin Du

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx