From: Cao jin <caoj.fnst@cn.fujitsu.com>
To: Marcel Apfelbaum <marcel@redhat.com>, qemu-devel@nongnu.org
Cc: Jiri Pirko <jiri@resnulli.us>, Gerd Hoffmann <kraxel@redhat.com>,
Dmitry Fleytman <dmitry@daynix.com>,
Jason Wang <jasowang@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Hannes Reinecke <hare@suse.de>,
Paolo Bonzini <pbonzini@redhat.com>,
Alex Williamson <alex.williamson@redhat.com>,
Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v5 03/10] pci: Convert msix_init() to Error and fix callers to check it
Date: Fri, 4 Nov 2016 11:01:52 +0800 [thread overview]
Message-ID: <581BFA20.4090802@cn.fujitsu.com> (raw)
In-Reply-To: <99c7ca3e-47ac-7c35-99b8-93fbda09a48f@redhat.com>
On 11/03/2016 07:38 PM, Marcel Apfelbaum wrote:
> On 11/03/2016 06:06 AM, Cao jin wrote:
>>
>
> [...]
>
>> diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
>> index 52a4123..fada834 100644
>> --- a/hw/scsi/megasas.c
>> +++ b/hw/scsi/megasas.c
>> @@ -2360,9 +2360,12 @@ static void megasas_scsi_realize(PCIDevice
>> *dev, Error **errp)
>>
>> if (megasas_use_msix(s) &&
>> msix_init(dev, 15, &s->mmio_io, b->mmio_bar, 0x2000,
>> - &s->mmio_io, b->mmio_bar, 0x3800, 0x68)) {
>> + &s->mmio_io, b->mmio_bar, 0x3800, 0x68, &err)) {
>> + /*TODO: check msix_init's error, and should fail on msix=on */
>
> Why this "TODO", can't we do something similar to other changes already
> done in this patch?
>
The 1st version of this series handles the error in this patch. look at
the comments:
http://lists.nongnu.org/archive/html/qemu-devel/2016-08/msg03192.html
*First convert msix_init() without changing behavior, by having every
caller of msix_init() immediately pass the error received to
error_report_err(). Then clean up the callers one after the other.*
So later, this patch looks like what it is now. I feel it also make this
patch thinner, easier to review.
>> + error_report_err(err);
>> s->msix = ON_OFF_AUTO_OFF;
>> }
>> +
>> if (pci_is_express(dev)) {
>> pcie_endpoint_cap_init(dev, 0xa0);
>> }
>> diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
>>
>> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
>> index d7dbe0e..6fbd30f 100644
>> --- a/hw/vfio/pci.c
>> +++ b/hw/vfio/pci.c
>> @@ -1432,6 +1432,7 @@ static void vfio_msix_early_setup(VFIOPCIDevice
>> *vdev, Error **errp)
>> static int vfio_msix_setup(VFIOPCIDevice *vdev, int pos, Error **errp)
>> {
>> int ret;
>> + Error *err = NULL;
>>
>> vdev->msix->pending = g_malloc0(BITS_TO_LONGS(vdev->msix->entries) *
>> sizeof(unsigned long));
>> @@ -1439,7 +1440,8 @@ static int vfio_msix_setup(VFIOPCIDevice *vdev,
>> int pos, Error **errp)
>> vdev->bars[vdev->msix->table_bar].region.mem,
>> vdev->msix->table_bar, vdev->msix->table_offset,
>> vdev->bars[vdev->msix->pba_bar].region.mem,
>> - vdev->msix->pba_bar, vdev->msix->pba_offset, pos);
>> + vdev->msix->pba_bar, vdev->msix->pba_offset, pos,
>> + &err);
>
> Do we pass the err pointer to msix_init, but we don't do anything with it?
>
> Also since we do have an *errp in the function already, I suggest
> renaming err -> local_err or something. (only if the series needs a
> re-spin)
>
yes, it maybe need a re-spin, thanks
>> if (ret < 0) {
>> if (ret == -ENOTSUP) {
>> return 0;
>> diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
>> index 06831de..5acce38 100644
>> --- a/hw/virtio/virtio-pci.c
>> +++ b/hw/virtio/virtio-pci.c
>> @@ -1693,13 +1693,12 @@ static void
>> virtio_pci_device_plugged(DeviceState *d, Error **errp)
>>
>> if (proxy->nvectors) {
>> int err = msix_init_exclusive_bar(&proxy->pci_dev,
>> proxy->nvectors,
>> - proxy->msix_bar_idx);
>> + proxy->msix_bar_idx, errp);
>> + /* Any error other than -ENOTSUP(board's MSI support is broken)
>> + * is a programming error. */
>> + assert(!err || err == -ENOTSUP);
>> if (err) {
>> - /* Notice when a system that supports MSIx can't
>> initialize it. */
>> - if (err != -ENOTSUP) {
>> - error_report("unable to init msix vectors to %" PRIu32,
>> - proxy->nvectors);
>> - }
>> + error_report_err(*errp);
>
> Why do we report the error here and we don't let the propagation
> mechanism do its thing? We can prep-end the current message, I think.
>
The original behaviour won't fail on msix init failure, so, report &
free the Error keep the behaviour same as before, propagation will
results in failing to create virtio device.
>
>
> Other than a few questions, the patch looks good to me.
>
> Thanks!
> Marcel
>
--
Yours Sincerely,
Cao jin
next prev parent reply other threads:[~2016-11-04 2:59 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-03 4:06 [Qemu-devel] [PATCH v5 00/10] Convert msix_init() to error Cao jin
2016-11-03 4:06 ` [Qemu-devel] [PATCH v5 01/10] msix: Follow CODING_STYLE Cao jin
2016-11-03 4:06 ` [Qemu-devel] [PATCH v5 02/10] hcd-xhci: check & correct param before using it Cao jin
2016-11-03 4:06 ` [Qemu-devel] [PATCH v5 03/10] pci: Convert msix_init() to Error and fix callers to check it Cao jin
2016-11-03 11:38 ` Marcel Apfelbaum
2016-11-04 3:01 ` Cao jin [this message]
2016-11-05 16:52 ` Marcel Apfelbaum
2016-11-03 4:06 ` [Qemu-devel] [PATCH v5 04/10] megasas: change behaviour of msix switch Cao jin
2016-11-03 4:06 ` [Qemu-devel] [PATCH v5 05/10] hcd-xhci: " Cao jin
2016-11-03 4:06 ` [Qemu-devel] [PATCH v5 06/10] megasas: remove unnecessary megasas_use_msix() Cao jin
2016-11-03 4:06 ` [Qemu-devel] [PATCH v5 07/10] megasas: undo the overwrites of msi user configuration Cao jin
2016-11-03 4:06 ` [Qemu-devel] [PATCH v5 08/10] vmxnet3: fix reference leak issue Cao jin
2016-11-03 4:06 ` [Qemu-devel] [PATCH v5 09/10] vmxnet3: remove unnecessary internal msix flag Cao jin
2016-11-03 4:06 ` [Qemu-devel] [PATCH v5 10/10] msi_init: convert assert to return -errno Cao jin
2016-11-03 6:16 ` Cao jin
2016-11-03 6:05 ` [Qemu-devel] [PATCH v5 00/10] Convert msix_init() to error Cao jin
2016-11-03 6:10 ` [Qemu-devel] [PATCH v5 10/10] msi_init: convert assert to return -errno Cao jin
2016-11-03 11:47 ` Marcel Apfelbaum
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=581BFA20.4090802@cn.fujitsu.com \
--to=caoj.fnst@cn.fujitsu.com \
--cc=alex.williamson@redhat.com \
--cc=armbru@redhat.com \
--cc=dmitry@daynix.com \
--cc=hare@suse.de \
--cc=jasowang@redhat.com \
--cc=jiri@resnulli.us \
--cc=kraxel@redhat.com \
--cc=marcel@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 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.