[Spice-devel] [PATCH qxl-wddm-dod v5 7/7] Fixing possible BSOD

Frediano Ziglio fziglio at redhat.com
Mon Sep 26 13:33:54 UTC 2016


> 
> Interrupts seem to arrive to the driver before the initialization phase
> is over (m_pHWDevice = NULL), in that case we can't handle interrupts yet.

I would remove the "seem"

> Even
> when m_pHWDevice isn't NULL, other fields aren't necessarly fully intialized
> till
> the StartDevice function has finished initialization, thus the flag
> DriverStarted should be checked upon interrupts.
> 
> Note: There is no way provided by microsoft to disable interrupts in WDDM
> drivers.
> 
> Signed-off-by: Sameeh Jubran <sameeh at daynix.com>
> ---
>  qxldod/QxlDod.cpp | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
> index 3fb30ce..7de64e9 100755
> --- a/qxldod/QxlDod.cpp
> +++ b/qxldod/QxlDod.cpp
> @@ -62,6 +62,7 @@ QxlDod::QxlDod(_In_ DEVICE_OBJECT* pPhysicalDeviceObject) :
> m_pPhysicalDevice(pP
>      PAGED_CODE();
>      DbgPrint(TRACE_LEVEL_INFORMATION, ("---> %s\n", __FUNCTION__));
>      *((UINT*)&m_Flags) = 0;
> +    m_Flags.DriverStarted = FALSE;
>      RtlZeroMemory(&m_DxgkInterface, sizeof(m_DxgkInterface));
>      RtlZeroMemory(&m_DeviceInfo, sizeof(m_DeviceInfo));
>      RtlZeroMemory(m_CurrentModes, sizeof(m_CurrentModes));

This should be no-op but better to explicit.

> @@ -1684,7 +1685,10 @@ VOID QxlDod::DpcRoutine(VOID)
>  BOOLEAN QxlDod::InterruptRoutine(_In_  ULONG MessageNumber)
>  {
>      DbgPrint(TRACE_LEVEL_INFORMATION, ("<--> 0 %s\n", __FUNCTION__));
> -    return m_pHWDevice->InterruptRoutine(&m_DxgkInterface, MessageNumber);
> +    if (m_Flags.DriverStarted) {
> +        return m_pHWDevice ? m_pHWDevice->InterruptRoutine(&m_DxgkInterface,
> MessageNumber) : FALSE;
> +    }
> +    return FALSE;
>  }
>  
>  VOID QxlDod::ResetDevice(VOID)

What about

    if (m_Flags.DriverStarted && m_pHWDevice) {
        return m_pHWDevice->InterruptRoutine(&m_DxgkInterface, MessageNumber);
    }
    return FALSE;

Rest is fine, I can do the change by myself if you agree or I'll merge as it otherwise.

Acked-by: Frediano Ziglio <fziglio at redhat.com>

Frediano


More information about the Spice-devel mailing list