* [Qemu-devel] [PATCH master+0.12] pci: irq_state vmstate breakage
@ 2010-05-09 16:15 Michael S. Tsirkin
2010-05-09 18:07 ` [Qemu-devel] " Juan Quintela
0 siblings, 1 reply; 3+ messages in thread
From: Michael S. Tsirkin @ 2010-05-09 16:15 UTC (permalink / raw)
To: quintela, qemu-devel, Anthony Liguori
Code for saving irq_state got vm_state
macros wrong, passing in the wrong parameter.
As a result, we both saved a wrong value
and restored it to a wrong offset.
This leads to device and bus irq counts getting
out of sync, which in turn leads to interrupts getting lost or
never cleared, such as
https://bugzilla.redhat.com/show_bug.cgi?id=588133
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
Juan, could you please take a look at this patch?
I managed to catch this bug by looking at
a savevm image which already has a wrong value,
but I could not reproduce it locally so I don't know
for sure whether patch is enough, or there are other bugs.
Anthony, this is a regression introduced in
eea4acfa5c1ef26439a718375475fe468b7f2fba
so we need the fix on 0.12 branch as well.
hw/pci.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/pci.c b/hw/pci.c
index 95bfa3d..5452b86 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -325,7 +325,7 @@ static VMStateInfo vmstate_info_pci_config = {
static int get_pci_irq_state(QEMUFile *f, void *pv, size_t size)
{
- PCIDevice *s = container_of(pv, PCIDevice, config);
+ PCIDevice *s = container_of(pv, PCIDevice, irq_state);
uint32_t irq_state[PCI_NUM_PINS];
int i;
for (i = 0; i < PCI_NUM_PINS; ++i) {
@@ -347,7 +347,7 @@ static int get_pci_irq_state(QEMUFile *f, void *pv, size_t size)
static void put_pci_irq_state(QEMUFile *f, void *pv, size_t size)
{
int i;
- PCIDevice *s = container_of(pv, PCIDevice, config);
+ PCIDevice *s = container_of(pv, PCIDevice, irq_state);
for (i = 0; i < PCI_NUM_PINS; ++i) {
qemu_put_be32(f, pci_irq_state(s, i));
--
1.7.1.12.g42b7f
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Qemu-devel] Re: [PATCH master+0.12] pci: irq_state vmstate breakage
2010-05-09 16:15 [Qemu-devel] [PATCH master+0.12] pci: irq_state vmstate breakage Michael S. Tsirkin
@ 2010-05-09 18:07 ` Juan Quintela
2010-05-09 21:08 ` Michael S. Tsirkin
0 siblings, 1 reply; 3+ messages in thread
From: Juan Quintela @ 2010-05-09 18:07 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: qemu-devel
"Michael S. Tsirkin" <mst@redhat.com> wrote:
> Code for saving irq_state got vm_state
> macros wrong, passing in the wrong parameter.
> As a result, we both saved a wrong value
> and restored it to a wrong offset.
>
> This leads to device and bus irq counts getting
> out of sync, which in turn leads to interrupts getting lost or
> never cleared, such as
> https://bugzilla.redhat.com/show_bug.cgi?id=588133
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Code is "obviously" wrong (TM). I didn't catch it when it was
introduced. How can it ever have worked since that commit?
> ---
>
> Juan, could you please take a look at this patch?
> I managed to catch this bug by looking at
> a savevm image which already has a wrong value,
> but I could not reproduce it locally so I don't know
> for sure whether patch is enough, or there are other bugs.
>
> Anthony, this is a regression introduced in
> eea4acfa5c1ef26439a718375475fe468b7f2fba
> so we need the fix on 0.12 branch as well.
>
> hw/pci.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/pci.c b/hw/pci.c
> index 95bfa3d..5452b86 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -325,7 +325,7 @@ static VMStateInfo vmstate_info_pci_config = {
>
> static int get_pci_irq_state(QEMUFile *f, void *pv, size_t size)
> {
> - PCIDevice *s = container_of(pv, PCIDevice, config);
> + PCIDevice *s = container_of(pv, PCIDevice, irq_state);
> uint32_t irq_state[PCI_NUM_PINS];
> int i;
> for (i = 0; i < PCI_NUM_PINS; ++i) {
> @@ -347,7 +347,7 @@ static int get_pci_irq_state(QEMUFile *f, void *pv, size_t size)
> static void put_pci_irq_state(QEMUFile *f, void *pv, size_t size)
> {
> int i;
> - PCIDevice *s = container_of(pv, PCIDevice, config);
> + PCIDevice *s = container_of(pv, PCIDevice, irq_state);
>
> for (i = 0; i < PCI_NUM_PINS; ++i) {
> qemu_put_be32(f, pci_irq_state(s, i));
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] Re: [PATCH master+0.12] pci: irq_state vmstate breakage
2010-05-09 18:07 ` [Qemu-devel] " Juan Quintela
@ 2010-05-09 21:08 ` Michael S. Tsirkin
0 siblings, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2010-05-09 21:08 UTC (permalink / raw)
To: Juan Quintela; +Cc: qemu-devel
On Sun, May 09, 2010 at 08:07:14PM +0200, Juan Quintela wrote:
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > Code for saving irq_state got vm_state
> > macros wrong, passing in the wrong parameter.
> > As a result, we both saved a wrong value
> > and restored it to a wrong offset.
> >
> > This leads to device and bus irq counts getting
> > out of sync, which in turn leads to interrupts getting lost or
> > never cleared, such as
> > https://bugzilla.redhat.com/show_bug.cgi?id=588133
> >
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>
> Acked-by: Juan Quintela <quintela@redhat.com>
>
> Code is "obviously" wrong (TM). I didn't catch it when it was
> introduced. How can it ever have worked since that commit?
irq_state is often 0, that's why.
> > ---
> >
> > Juan, could you please take a look at this patch?
> > I managed to catch this bug by looking at
> > a savevm image which already has a wrong value,
> > but I could not reproduce it locally so I don't know
> > for sure whether patch is enough, or there are other bugs.
> >
> > Anthony, this is a regression introduced in
> > eea4acfa5c1ef26439a718375475fe468b7f2fba
> > so we need the fix on 0.12 branch as well.
> >
> > hw/pci.c | 4 ++--
> > 1 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/hw/pci.c b/hw/pci.c
> > index 95bfa3d..5452b86 100644
> > --- a/hw/pci.c
> > +++ b/hw/pci.c
> > @@ -325,7 +325,7 @@ static VMStateInfo vmstate_info_pci_config = {
> >
> > static int get_pci_irq_state(QEMUFile *f, void *pv, size_t size)
> > {
> > - PCIDevice *s = container_of(pv, PCIDevice, config);
> > + PCIDevice *s = container_of(pv, PCIDevice, irq_state);
> > uint32_t irq_state[PCI_NUM_PINS];
> > int i;
> > for (i = 0; i < PCI_NUM_PINS; ++i) {
> > @@ -347,7 +347,7 @@ static int get_pci_irq_state(QEMUFile *f, void *pv, size_t size)
> > static void put_pci_irq_state(QEMUFile *f, void *pv, size_t size)
> > {
> > int i;
> > - PCIDevice *s = container_of(pv, PCIDevice, config);
> > + PCIDevice *s = container_of(pv, PCIDevice, irq_state);
> >
> > for (i = 0; i < PCI_NUM_PINS; ++i) {
> > qemu_put_be32(f, pci_irq_state(s, i));
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-05-09 21:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-09 16:15 [Qemu-devel] [PATCH master+0.12] pci: irq_state vmstate breakage Michael S. Tsirkin
2010-05-09 18:07 ` [Qemu-devel] " Juan Quintela
2010-05-09 21:08 ` Michael S. Tsirkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).