qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Klaus Jensen <its@irrelevant.dk>
Cc: qemu-devel@nongnu.org, Keith Busch <kbusch@kernel.org>,
	Markus Armbruster <armbru@redhat.com>,
	qemu-block@nongnu.org, Klaus Jensen <k.jensen@samsung.com>
Subject: Re: [PATCH v3 2/2] hw/nvme: cleanup error reporting in nvme_init_pci()
Date: Fri, 11 Nov 2022 13:56:57 +0100	[thread overview]
Message-ID: <47bfb5ee-c825-8e04-430f-68e2f0819732@linaro.org> (raw)
In-Reply-To: <Y25A0Qx95NtrPmA3@cormorant.local>

On 11/11/22 13:32, Klaus Jensen wrote:
> On Nov 11 12:40, Philippe Mathieu-Daudé wrote:
>> On 10/11/22 23:08, Klaus Jensen wrote:
>>> From: Klaus Jensen <k.jensen@samsung.com>
>>>
>>> Replace the local Error variable with errp and ERRP_GUARD() and change
>>> the return value to bool.
>>>
>>> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
>>> ---
>>>    hw/nvme/ctrl.c | 23 ++++++++++-------------
>>>    1 file changed, 10 insertions(+), 13 deletions(-)
>>
>>
>>> @@ -7388,14 +7387,12 @@ static int nvme_init_pci(NvmeCtrl *n, PCIDevice *pci_dev, Error **errp)
>>>        }
>>>        ret = msix_init(pci_dev, n->params.msix_qsize,
>>>                        &n->bar0, 0, msix_table_offset,
>>> -                    &n->bar0, 0, msix_pba_offset, 0, &err);
>>> -    if (ret < 0) {
>>> -        if (ret == -ENOTSUP) {
>>> -            warn_report_err(err);
>>> -        } else {
>>> -            error_propagate(errp, err);
>>> -            return ret;
>>> -        }
>>> +                    &n->bar0, 0, msix_pba_offset, 0, errp);
>>> +    if (ret == -ENOTSUP) {
>>> +        warn_report_err(*errp);
>>
>> Why only report ENOTSUP in particular?
>>
> 
> Because the error is beneign (it's just a notice that MSI-X isnt
> available on the platform).
> 
>>> +        *errp = NULL;
>>> +    } else if (ret < 0) {
>>> +        return false;
>>
>> Is that normal to ignore:
>>
>> -   error_setg(errp, "The number of MSI-X vectors is invalid");
>>      return -EINVAL;
>>
>> -   error_setg(errp, "table & pba overlap, or they don't fit in BARs,"
>>                       " or don't align");
>>      return -EINVAL;
>>
>> Or possible future error added in msix_init()?
> 
> It is not ignored, it is passed up to the caller. On any other error,
> returning false will cause device realization to fail and the error
> (i.e. invalid vectors or overlap) be reported.

Indeed, I didn't review carefully enough.

Maybe in the first case explicit with /* Convert the error as a simple 
warning */ and in the second /* Propagate to caller */.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



      reply	other threads:[~2022-11-11 12:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-10 22:08 [PATCH v3 0/2] hw/nvme: errp fixes Klaus Jensen
2022-11-10 22:08 ` [PATCH v3 1/2] hw/nvme: fix incorrect use of errp/local_err Klaus Jensen
2022-11-11  6:36   ` Markus Armbruster
2022-11-11  6:41     ` Klaus Jensen
2022-11-11  6:55       ` Markus Armbruster
2022-11-11  7:09         ` Klaus Jensen
2022-11-11 11:17           ` Markus Armbruster
2022-11-10 22:08 ` [PATCH v3 2/2] hw/nvme: cleanup error reporting in nvme_init_pci() Klaus Jensen
2022-11-11 11:40   ` Philippe Mathieu-Daudé
2022-11-11 12:32     ` Klaus Jensen
2022-11-11 12:56       ` Philippe Mathieu-Daudé [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=47bfb5ee-c825-8e04-430f-68e2f0819732@linaro.org \
    --to=philmd@linaro.org \
    --cc=armbru@redhat.com \
    --cc=its@irrelevant.dk \
    --cc=k.jensen@samsung.com \
    --cc=kbusch@kernel.org \
    --cc=qemu-block@nongnu.org \
    --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).