From: Markus Armbruster <armbru@redhat.com>
To: Cao jin <caoj.fnst@cn.fujitsu.com>
Cc: qemu-devel@nongnu.org, mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH] Give detailed info when pcie downstream port init failed
Date: Mon, 30 Nov 2015 08:58:39 +0100 [thread overview]
Message-ID: <87egf7ex5c.fsf@blackfin.pond.sub.org> (raw)
In-Reply-To: <56595685.4070501@cn.fujitsu.com> (Cao jin's message of "Sat, 28 Nov 2015 15:23:49 +0800")
Cao jin <caoj.fnst@cn.fujitsu.com> writes:
> On 11/27/2015 10:22 PM, Markus Armbruster wrote:
>> Cao jin <caoj.fnst@cn.fujitsu.com> writes:
>>
>>> Hi, Markus
>>>
>>> On 11/24/2015 06:08 PM, Markus Armbruster wrote:
> [...]
>>>
>>> and this will cover to output to the monitor, right?
>>
>> The device still implements the old PCIDeviceClass.init() instead of the
>> new .realize(). All devices need to be converted to .realize(). You
>> can help by converting this one.
>>
>> .init() reports errors with error_report() and returns 0 on success, -1
>> on failure.
>>
>> .realize() passes errors to its callers via its errp argument.
>>
>
> After reading you commit 28b07e7, I am aware of this;) Thanks very
> much for your detailed explanation:) I was always curious about why
> there are 2 function(.init() & .realize()) for initializing device,
> now I guess I get it: it has just .init() at first, because of error
> report issue, the .realize() is added to replace it, in order to pass
> the error above. Do I understand it right ?
Yes!
> If I understand it right, I see there are still devices initialization
> using .init() of DeviceClass & PCIDeviceClass, maybe I can help to
> convert some of these.
That would be helpful. There are probably easy cases where you only
have to convert one device model at a time, and more complex cases,
where you have to convert supporting functions from error_report() to
error_set(), or convert device classes, not just individual devices.
Best try an easy one first.
>> Commit 28b07e7 can serve as example of how to convert a device to
>> realize(). There are many more. The ones I did usually have "Convert
>> to realize()" in the commit message's first line.
>>
>
>> Regarding six error paths: I counted six places that return -1 directly
>> or goto err or similar. Your patch adds a suitable error message to one
>> of them. The other five need one, too. You'll have to examine the
>> called functions to find out whether they report anything. If they do,
>> they need to be first converted to pass an Error to their callers
>> instead.
>>
>
> It seems I have a misunderstanding about the "6 error paths":-[ I
> thought "error path" is a "error *reporting path*", like: fprintf the
> msg to stderr is a path, while output it via QMP is also a
> path. Because I did`t touch the code about -chardev/-mon/-monitor/-qmp
> before, so I spent 2 days reading the code:)
Welcome to the club :)
> Now I am cleared, Thanks you very much for the clarifying, Markus, I
> think this mistake won`t happen to me later;) And actually, I was
> already thinking add suitable error msg to each error path:)
Glad I could help you!
prev parent reply other threads:[~2015-11-30 7:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-24 9:54 [Qemu-devel] [PATCH] Give detailed info when pcie downstream port init failed Cao jin
2015-11-24 10:08 ` Markus Armbruster
2015-11-24 10:42 ` Cao jin
2015-11-27 10:28 ` Cao jin
2015-11-27 14:22 ` Markus Armbruster
2015-11-28 7:23 ` Cao jin
2015-11-30 7:58 ` Markus Armbruster [this message]
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=87egf7ex5c.fsf@blackfin.pond.sub.org \
--to=armbru@redhat.com \
--cc=caoj.fnst@cn.fujitsu.com \
--cc=mst@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 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.