qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: SeokYeon Hwang <syeon.hwang@samsung.com>
To: "'Michael S. Tsirkin'" <mst@redhat.com>
Cc: 'Paolo Bonzini' <pbonzini@redhat.com>,
	'Markus Armbruster' <armbru@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] pci: fixed mismatch of error-handling between pci_qdev_init() and qdev
Date: Fri, 07 Nov 2014 13:17:53 +0900	[thread overview]
Message-ID: <077901cffa41$cd7467d0$685d3770$@samsung.com> (raw)
In-Reply-To: <20141106092355.GA15186@redhat.com>

> -----Original Message-----
> From: Michael S. Tsirkin [mailto:mst@redhat.com]
> Sent: Thursday, November 06, 2014 6:24 PM
> To: SeokYeon Hwang
> Cc: 'Paolo Bonzini'; 'Markus Armbruster'; qemu-devel@nongnu.org
> Subject: Re: [Qemu-devel] [PATCH] pci: fixed mismatch of error-handling
> between pci_qdev_init() and qdev
> 
> On Thu, Nov 06, 2014 at 11:26:01AM +0900, SeokYeon Hwang wrote:
> >
> >
> > > -----Original Message-----
> > > From: Paolo Bonzini [mailto:paolo.bonzini@gmail.com] On Behalf Of
> > > Paolo Bonzini
> > > Sent: Wednesday, November 05, 2014 11:55 PM
> > > To: Michael S. Tsirkin
> > > Cc: Markus Armbruster; SeokYeon Hwang; qemu-devel@nongnu.org
> > > Subject: Re: [Qemu-devel] [PATCH] pci: fixed mismatch of
> > > error-handling between pci_qdev_init() and qdev
> > >
> > >
> > >
> > > On 05/11/2014 14:28, Michael S. Tsirkin wrote:
> > > > > I think bypassing the question by converting to realize makes
> > > > > the most sense...
> > > >
> > > > I'm fine with doing that but Markus's patches wouldn't yet have
> > > > solved the problem by themselves since init is still around, right?
> > > >
> > > > This probably means fixing this bug can't justify merging the
> > > > realize patchset after freeze.
> > >
> > > Yes, I agree.  I meant that the API is not very well defined.  I
> > > would handle everything else on a case-by-case basis, by reviewing
> > > each init function that is converted to realize.
> > >
> > > Since the patch was for an out-of-tree device, it can wait for 2.3
> anyway.
> > >
> > > Paolo
> >
> > I cannot fully understand your conversation.
> > But, I think this patch is still worth before all 'init()' convert to
> > 'realize()'.
> > Moreover, It has no side effect at all.
> >
> > Thanks.
> >
> 
> The root cause is API misuse: functions that return int should return a
> negative code on failure, either 0 or >= 0 on success.
> In rare cases, we use int as bool, so 0 on failure, 1 on success.
> 
> Your device returned 1 on failure, this broke things.
> So don't do this then :)
> 
> The question would be: are there existing devices that return a positive
> return code on init. If there are, it's a bug, but the best fix might be
> your patch - easier that fixing many devices.
> 
> If there aren't, the patch isn't needed.
> 
> --
> MST

You are right.
Yes, it is API misuse. So we had fixed the device that return positive value
on failure.

But is that all right ?? I don't think so, because this logic is obviously
wrong.
'pci_qdev_init()' should return -1 (not rc) on failure or should check 'rc <
0' not 'rc != 0'. That is what I wanted to fix.

But if 2.2 comes with all "realized" devices, if there is no "init" devices,
then this patch isn't needed.

Thanks

  reply	other threads:[~2014-11-07  4:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-05 10:11 [Qemu-devel] [PATCH] pci: fixed mismatch of error-handling between pci_qdev_init() and qdev SeokYeon Hwang
2014-11-05 10:59 ` Paolo Bonzini
2014-11-05 12:46 ` Michael S. Tsirkin
2014-11-05 13:16   ` Markus Armbruster
2014-11-05 13:18     ` Paolo Bonzini
2014-11-05 13:28       ` Michael S. Tsirkin
2014-11-05 14:55         ` Paolo Bonzini
2014-11-06  2:26           ` SeokYeon Hwang
2014-11-06  9:20             ` Markus Armbruster
2014-11-06  9:26               ` Michael S. Tsirkin
2014-11-06  9:41               ` SeokYeon Hwang
2014-11-06  9:23             ` Michael S. Tsirkin
2014-11-07  4:17               ` SeokYeon Hwang [this message]
2014-11-07  7:45                 ` Markus Armbruster
2014-11-10  8:24                   ` SeokYeon Hwang
2014-11-10  8:50                     ` Markus Armbruster
2014-11-05 13:28   ` SeokYeon Hwang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='077901cffa41$cd7467d0$685d3770$@samsung.com' \
    --to=syeon.hwang@samsung.com \
    --cc=armbru@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).