From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2ZqP-00043P-5m for qemu-devel@nongnu.org; Sat, 28 Nov 2015 02:22:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a2ZqM-0001h9-1q for qemu-devel@nongnu.org; Sat, 28 Nov 2015 02:22:53 -0500 Received: from [59.151.112.132] (port=59928 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2ZqL-0001g5-LA for qemu-devel@nongnu.org; Sat, 28 Nov 2015 02:22:49 -0500 References: <1448358898-2350-1-git-send-email-caoj.fnst@cn.fujitsu.com> <87oaej6772.fsf@blackfin.pond.sub.org> <5658306A.8050903@cn.fujitsu.com> <87wpt3zfmn.fsf@blackfin.pond.sub.org> From: Cao jin Message-ID: <56595685.4070501@cn.fujitsu.com> Date: Sat, 28 Nov 2015 15:23:49 +0800 MIME-Version: 1.0 In-Reply-To: <87wpt3zfmn.fsf@blackfin.pond.sub.org> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] Give detailed info when pcie downstream port init failed List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org, mst@redhat.com On 11/27/2015 10:22 PM, Markus Armbruster wrote: > Cao jin 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 ? 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. > 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:) 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:) > . > -- Yours Sincerely, Cao Jin