All of lore.kernel.org
 help / color / mirror / Atom feed
* off by 1 in pci_piix3_xen_ide_unplug
@ 2014-10-29  8:21 James Harper
  2014-10-29 10:42 ` Andrew Cooper
  0 siblings, 1 reply; 5+ messages in thread
From: James Harper @ 2014-10-29  8:21 UTC (permalink / raw)
  To: xen-devel

It seems that qemu isn't unplugging all my disks, leaving my /dev/xvdd plugged in, with obvious consequences.

pci_piix3_xen_ide_unplug appears to only be counting to disk < 3, when it should be <= 3 or < 4.

Where do qemu patches go?

James

diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index 574b9c1..b6b30a4 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -175,7 +175,7 @@ int pci_piix3_xen_ide_unplug(DeviceState *dev)

     pci_ide = PCI_IDE(dev);

-    for (; i < 3; i++) {
+    for (; i < 4; i++) {
         di = drive_get_by_index(IF_IDE, i);
         if (di != NULL && !di->media_cd) {
             BlockBackend *blk = blk_by_legacy_dinfo(di);

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: off by 1 in pci_piix3_xen_ide_unplug
  2014-10-29  8:21 off by 1 in pci_piix3_xen_ide_unplug James Harper
@ 2014-10-29 10:42 ` Andrew Cooper
  2014-10-29 11:55   ` Stefano Stabellini
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cooper @ 2014-10-29 10:42 UTC (permalink / raw)
  To: James Harper, xen-devel; +Cc: Stefano Stabellini

On 29/10/14 08:21, James Harper wrote:
> It seems that qemu isn't unplugging all my disks, leaving my /dev/xvdd plugged in, with obvious consequences.
>
> pci_piix3_xen_ide_unplug appears to only be counting to disk < 3, when it should be <= 3 or < 4.
>
> Where do qemu patches go?
>
> James

I presume this is qemu-upstream, as qemu-trad doesn't have an hw/ide
directory.

CCing Stefano as the maintainer.

For what its worth, I agree that it really should be 4.

~Andrew

>
> diff --git a/hw/ide/piix.c b/hw/ide/piix.c
> index 574b9c1..b6b30a4 100644
> --- a/hw/ide/piix.c
> +++ b/hw/ide/piix.c
> @@ -175,7 +175,7 @@ int pci_piix3_xen_ide_unplug(DeviceState *dev)
>
>      pci_ide = PCI_IDE(dev);
>
> -    for (; i < 3; i++) {
> +    for (; i < 4; i++) {
>          di = drive_get_by_index(IF_IDE, i);
>          if (di != NULL && !di->media_cd) {
>              BlockBackend *blk = blk_by_legacy_dinfo(di);
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: off by 1 in pci_piix3_xen_ide_unplug
  2014-10-29 10:42 ` Andrew Cooper
@ 2014-10-29 11:55   ` Stefano Stabellini
  2014-10-29 20:38     ` James Harper
  0 siblings, 1 reply; 5+ messages in thread
From: Stefano Stabellini @ 2014-10-29 11:55 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: James Harper, xen-devel, Stefano Stabellini

On Wed, 29 Oct 2014, Andrew Cooper wrote:
> On 29/10/14 08:21, James Harper wrote:
> > It seems that qemu isn't unplugging all my disks, leaving my /dev/xvdd plugged in, with obvious consequences.
> >
> > pci_piix3_xen_ide_unplug appears to only be counting to disk < 3, when it should be <= 3 or < 4.
> >
> > Where do qemu patches go?
> >

You need to send them to qemu-devel, CC'ing xen-devel and me.


> I presume this is qemu-upstream, as qemu-trad doesn't have an hw/ide
> directory.
> 
> CCing Stefano as the maintainer.
> 
> For what its worth, I agree that it really should be 4.

I think it should be 4 too. Well spotted!

Could you please resend to qemu-devel with your signed-off-by line?

Thanks!


 
> > diff --git a/hw/ide/piix.c b/hw/ide/piix.c
> > index 574b9c1..b6b30a4 100644
> > --- a/hw/ide/piix.c
> > +++ b/hw/ide/piix.c
> > @@ -175,7 +175,7 @@ int pci_piix3_xen_ide_unplug(DeviceState *dev)
> >
> >      pci_ide = PCI_IDE(dev);
> >
> > -    for (; i < 3; i++) {
> > +    for (; i < 4; i++) {
> >          di = drive_get_by_index(IF_IDE, i);
> >          if (di != NULL && !di->media_cd) {
> >              BlockBackend *blk = blk_by_legacy_dinfo(di);
> >
> > _______________________________________________
> > Xen-devel mailing list
> > Xen-devel@lists.xen.org
> > http://lists.xen.org/xen-devel
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: off by 1 in pci_piix3_xen_ide_unplug
  2014-10-29 11:55   ` Stefano Stabellini
@ 2014-10-29 20:38     ` James Harper
  2014-10-29 22:07       ` Stefano Stabellini
  0 siblings, 1 reply; 5+ messages in thread
From: James Harper @ 2014-10-29 20:38 UTC (permalink / raw)
  To: Stefano Stabellini, Andrew Cooper; +Cc: xen-devel

> > >
> > > Where do qemu patches go?
> > >
> 
> You need to send them to qemu-devel, CC'ing xen-devel and me.
> 

Will do.

The style of the for loop bothers me too...

int i = 0;
...
for (; i < 4; i++) {
...

Given that i is only used here, and the start value is a constant, this is more readable:

int i;
...
for (i = 0; i < 4; i++) {
...

Then it is immediately obvious what the bounds of the loop are without having to look elsewhere for i.

Am I being too pedantic here? If I wanted to propose a change, would that be a separate patch?

James

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: off by 1 in pci_piix3_xen_ide_unplug
  2014-10-29 20:38     ` James Harper
@ 2014-10-29 22:07       ` Stefano Stabellini
  0 siblings, 0 replies; 5+ messages in thread
From: Stefano Stabellini @ 2014-10-29 22:07 UTC (permalink / raw)
  To: James Harper; +Cc: Andrew Cooper, xen-devel, Stefano Stabellini

On Wed, 29 Oct 2014, James Harper wrote:
> > > >
> > > > Where do qemu patches go?
> > > >
> > 
> > You need to send them to qemu-devel, CC'ing xen-devel and me.
> > 
> 
> Will do.
> 
> The style of the for loop bothers me too...
> 
> int i = 0;
> ...
> for (; i < 4; i++) {
> ...
> 
> Given that i is only used here, and the start value is a constant, this is more readable:
> 
> int i;
> ...
> for (i = 0; i < 4; i++) {
> ...
> 
> Then it is immediately obvious what the bounds of the loop are without having to look elsewhere for i.
> 
> Am I being too pedantic here? If I wanted to propose a change, would that be a separate patch?

That's fine, you can fold that change in the same patch.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-10-29 22:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-29  8:21 off by 1 in pci_piix3_xen_ide_unplug James Harper
2014-10-29 10:42 ` Andrew Cooper
2014-10-29 11:55   ` Stefano Stabellini
2014-10-29 20:38     ` James Harper
2014-10-29 22:07       ` Stefano Stabellini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.