Patchwork Bug#688964: qemu-kvm: Fedora 17 guest hangs on boot with soft lockup in udevd

login
register
mail settings
Submitter Michael Tokarev
Date Sept. 27, 2012, 6:43 p.m.
Message ID <50649E6D.4050102@msgid.tls.msk.ru>
Download mbox | patch
Permalink /patch/187444/
State New
Headers show

Comments

Michael Tokarev - Sept. 27, 2012, 6:43 p.m.
On 27.09.2012 22:28, Jan Kiszka wrote:
[]
>> --- a/hw/intel-hda.c
>> +++ b/hw/intel-hda.c
>> @@ -1107,6 +1107,9 @@ static void intel_hda_reset(DeviceState *dev)
>>      DeviceState *qdev;
>>      HDACodecDevice *cdev;
>>
>> +    if (d->msi) {
>> +        msi_reset(&d->pci);
>> +    }
>>      intel_hda_regs_reset(d);
>>      d->wall_base_ns = qemu_get_clock_ns(vm_clock);
>>
>> which is exactly about this hda thing.  I'm CC'ing relevant
>> people here.
> 
> I suppose we are resetting the MSI configuration also in cases here
> where only the HDA internals are supposed to be reset (when called from
> intel_hda_set_g_ctl).

Hmm.  I was looking at this code already (but i don't know the machinery
anyway).  Here it is (I addedd two printfs in obvious places):

in intel_hda_reset
calling intel_hda_reset from intel_hda_set_g_ctl
in intel_hda_reset
(at this time it hangs in guest).

The following patch fixes it.  Is it correct? :)

/mjt
Jan Kiszka - Sept. 27, 2012, 7:03 p.m.
On 2012-09-27 20:43, Michael Tokarev wrote:
> On 27.09.2012 22:28, Jan Kiszka wrote:
> []
>>> --- a/hw/intel-hda.c
>>> +++ b/hw/intel-hda.c
>>> @@ -1107,6 +1107,9 @@ static void intel_hda_reset(DeviceState *dev)
>>>      DeviceState *qdev;
>>>      HDACodecDevice *cdev;
>>>
>>> +    if (d->msi) {
>>> +        msi_reset(&d->pci);
>>> +    }
>>>      intel_hda_regs_reset(d);
>>>      d->wall_base_ns = qemu_get_clock_ns(vm_clock);
>>>
>>> which is exactly about this hda thing.  I'm CC'ing relevant
>>> people here.
>>
>> I suppose we are resetting the MSI configuration also in cases here
>> where only the HDA internals are supposed to be reset (when called from
>> intel_hda_set_g_ctl).
> 
> Hmm.  I was looking at this code already (but i don't know the machinery
> anyway).  Here it is (I addedd two printfs in obvious places):
> 
> in intel_hda_reset
> calling intel_hda_reset from intel_hda_set_g_ctl
> in intel_hda_reset
> (at this time it hangs in guest).
> 
> The following patch fixes it.  Is it correct? :)
> 

It looks ok to me.

Jan
Michael S. Tsirkin - Sept. 27, 2012, 7:32 p.m.
On Thu, Sep 27, 2012 at 10:43:57PM +0400, Michael Tokarev wrote:
> On 27.09.2012 22:28, Jan Kiszka wrote:
> []
> >> --- a/hw/intel-hda.c
> >> +++ b/hw/intel-hda.c
> >> @@ -1107,6 +1107,9 @@ static void intel_hda_reset(DeviceState *dev)
> >>      DeviceState *qdev;
> >>      HDACodecDevice *cdev;
> >>
> >> +    if (d->msi) {
> >> +        msi_reset(&d->pci);
> >> +    }
> >>      intel_hda_regs_reset(d);
> >>      d->wall_base_ns = qemu_get_clock_ns(vm_clock);
> >>
> >> which is exactly about this hda thing.  I'm CC'ing relevant
> >> people here.
> > 
> > I suppose we are resetting the MSI configuration also in cases here
> > where only the HDA internals are supposed to be reset (when called from
> > intel_hda_set_g_ctl).
> 
> Hmm.  I was looking at this code already (but i don't know the machinery
> anyway).  Here it is (I addedd two printfs in obvious places):
> 
> in intel_hda_reset
> calling intel_hda_reset from intel_hda_set_g_ctl
> in intel_hda_reset
> (at this time it hangs in guest).
> 
> The following patch fixes it.  Is it correct? :)
> 
> /mjt

> diff --git a/hw/intel-hda.c b/hw/intel-hda.c
> index e38861e..fdd7eeb 100644
> --- a/hw/intel-hda.c
> +++ b/hw/intel-hda.c
> @@ -199,7 +199,7 @@ struct IntelHDAReg {
>      void       (*rhandler)(IntelHDAState *d, const IntelHDAReg *reg);
>  };
>  
> -static void intel_hda_reset(DeviceState *dev);
> +static void intel_hda_reset_dev(DeviceState *dev);
>  
>  /* --------------------------------------------------------------------- */
>  
> @@ -500,7 +500,7 @@ static void intel_hda_notify_codecs(IntelHDAState *d, uint32_t stream, bool runn
>  static void intel_hda_set_g_ctl(IntelHDAState *d, const IntelHDAReg *reg, uint32_t old)
>  {
>      if ((d->g_ctl & ICH6_GCTL_RESET) == 0) {
> -        intel_hda_reset(&d->pci.qdev);
> +        intel_hda_reset_dev(&d->pci.qdev);
>      }
>  }
>  
> @@ -1101,15 +1101,12 @@ static const MemoryRegionOps intel_hda_mmio_ops = {
>  
>  /* --------------------------------------------------------------------- */
>  
> -static void intel_hda_reset(DeviceState *dev)
> +static void intel_hda_reset_dev(DeviceState *dev)
>  {
>      IntelHDAState *d = DO_UPCAST(IntelHDAState, pci.qdev, dev);
>      DeviceState *qdev;
>      HDACodecDevice *cdev;
>  
> -    if (d->msi) {
> -        msi_reset(&d->pci);
> -    }
>      intel_hda_regs_reset(d);
>      d->wall_base_ns = qemu_get_clock_ns(vm_clock);
>  
> @@ -1122,6 +1119,15 @@ static void intel_hda_reset(DeviceState *dev)
>      intel_hda_update_irq(d);
>  }
>  
> +static void intel_hda_reset(DeviceState *dev)
> +{
> +    IntelHDAState *d = DO_UPCAST(IntelHDAState, pci.qdev, dev);
> +    if (d->msi) {
> +        msi_reset(&d->pci);
> +    }
> +    intel_hda_reset_dev(dev);
> +}
> +
>  static int intel_hda_init(PCIDevice *pci)
>  {
>      IntelHDAState *d = DO_UPCAST(IntelHDAState, pci, pci);


Looks good to me.
ACK for stable branch.
Michael Tokarev - Sept. 27, 2012, 7:34 p.m.
On 27.09.2012 23:32, Michael S. Tsirkin wrote:
[]
> Looks good to me.

I just sent another patch, now with proper S-o-b and
description, which does the same but touches 2 less
lines (by renaming the other half of the function), --
his is to be more like the 1.2+ version.  The
functionality is exactly the same.

> ACK for stable branch.

/mjt

Patch

diff --git a/hw/intel-hda.c b/hw/intel-hda.c
index e38861e..fdd7eeb 100644
--- a/hw/intel-hda.c
+++ b/hw/intel-hda.c
@@ -199,7 +199,7 @@  struct IntelHDAReg {
     void       (*rhandler)(IntelHDAState *d, const IntelHDAReg *reg);
 };
 
-static void intel_hda_reset(DeviceState *dev);
+static void intel_hda_reset_dev(DeviceState *dev);
 
 /* --------------------------------------------------------------------- */
 
@@ -500,7 +500,7 @@  static void intel_hda_notify_codecs(IntelHDAState *d, uint32_t stream, bool runn
 static void intel_hda_set_g_ctl(IntelHDAState *d, const IntelHDAReg *reg, uint32_t old)
 {
     if ((d->g_ctl & ICH6_GCTL_RESET) == 0) {
-        intel_hda_reset(&d->pci.qdev);
+        intel_hda_reset_dev(&d->pci.qdev);
     }
 }
 
@@ -1101,15 +1101,12 @@  static const MemoryRegionOps intel_hda_mmio_ops = {
 
 /* --------------------------------------------------------------------- */
 
-static void intel_hda_reset(DeviceState *dev)
+static void intel_hda_reset_dev(DeviceState *dev)
 {
     IntelHDAState *d = DO_UPCAST(IntelHDAState, pci.qdev, dev);
     DeviceState *qdev;
     HDACodecDevice *cdev;
 
-    if (d->msi) {
-        msi_reset(&d->pci);
-    }
     intel_hda_regs_reset(d);
     d->wall_base_ns = qemu_get_clock_ns(vm_clock);
 
@@ -1122,6 +1119,15 @@  static void intel_hda_reset(DeviceState *dev)
     intel_hda_update_irq(d);
 }
 
+static void intel_hda_reset(DeviceState *dev)
+{
+    IntelHDAState *d = DO_UPCAST(IntelHDAState, pci.qdev, dev);
+    if (d->msi) {
+        msi_reset(&d->pci);
+    }
+    intel_hda_reset_dev(dev);
+}
+
 static int intel_hda_init(PCIDevice *pci)
 {
     IntelHDAState *d = DO_UPCAST(IntelHDAState, pci, pci);