All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Cao jin <caoj.fnst@cn.fujitsu.com>,
	Marcel Apfelbaum <marcel@redhat.com>,
	qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 1/5] msix_init: assert programming error
Date: Tue, 13 Sep 2016 08:49:11 -0600	[thread overview]
Message-ID: <20160913084911.5fd310ee@t450s.home> (raw)
In-Reply-To: <87fup4iatn.fsf@dusky.pond.sub.org>

On Tue, 13 Sep 2016 08:16:20 +0200
Markus Armbruster <armbru@redhat.com> wrote:

> Cc: Alex for device assignment expertise.
> 
> Cao jin <caoj.fnst@cn.fujitsu.com> writes:
> 
> > On 09/12/2016 09:29 PM, Markus Armbruster wrote:  
> >> Cao jin <caoj.fnst@cn.fujitsu.com> writes:
> >>  
> >>> The input parameters is used for creating the msix capable device, so
> >>> they must obey the PCI spec, or else, it should be programming error.  
> >>
> >> True when the the parameters come from a device model attempting to
> >> define a PCI device violating the spec.  But what if the parameters come
> >> from an actual PCI device violating the spec, via device assignment?  
> >
> > Before the patch, on invalid param, the vfio behaviour is:
> >   error_report("vfio: msix_init failed");
> >   then, device create fail.
> >
> > After the patch, its behaviour is:
> >   asserted.
> >
> > Do you mean we should still report some useful info to user on invalid
> > params?  
> 
> In the normal case, asking msix_init() to create MSI-X that are out of
> spec is a programming error: the code that does it is broken and needs
> fixing.
> 
> Device assignment might be the exception: there, the parameters for
> msix_init() come from the assigned device, not the program.  If they
> violate the spec, the device is broken.  This wouldn't be a programming
> error.  Alex, can this happen?
> 
> If yes, we may want to handle it by failing device assignment.


Generally, I think the entire premise of these sorts of patches is
flawed.  We take a working error path that allows a driver to robustly
abort on unexpected date and turn it into a time bomb.  Often the
excuse for this is that "error handling is hard".  Tough.  Now a
hot-add of a device that triggers this changes from a simple failure to
a denial of service event.  Furthermore, we base that time bomb on our
interpretation of the spec, which we can only validate against in-tree
devices.

We have actually had assigned devices that fail the sanity test here,
there's a quirk in vfio_msix_early_setup() for a Chelsio device with
this bug.  Do we really want user experiencing aborts when a simple
device initialization failure is sufficient?

Generally abort code paths like this cause me to do my own sanity
testing, which is really poor practice since we should have that sanity
testing in the common code.  Thanks,

Alex

  reply	other threads:[~2016-09-13 14:49 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-23  9:27 [Qemu-devel] [PATCH v2 0/5] Convert msix_init() to error Cao jin
2016-08-23  9:27 ` [Qemu-devel] [PATCH v2 1/5] msix_init: assert programming error Cao jin
2016-09-12 13:29   ` Markus Armbruster
2016-09-13  2:51     ` Cao jin
2016-09-13  6:16       ` Markus Armbruster
2016-09-13 14:49         ` Alex Williamson [this message]
2016-09-29 13:11           ` Markus Armbruster
2016-09-29 16:10             ` Alex Williamson
2016-09-30 14:06               ` Markus Armbruster
2016-09-30 18:06                 ` Dr. David Alan Gilbert
2016-10-04  9:33                   ` Markus Armbruster
2016-10-04 11:19                     ` Dr. David Alan Gilbert
2016-10-06  7:00                 ` Cao jin
2016-08-23  9:27 ` [Qemu-devel] [PATCH v2 2/5] msix: Follow CODING_STYLE Cao jin
2016-08-23  9:27 ` [Qemu-devel] [PATCH v2 3/5] pci: Convert msix_init() to Error and fix callers to check it Cao jin
2016-09-12 13:47   ` Markus Armbruster
2016-09-13  6:04     ` Cao jin
2016-09-13  8:27       ` Markus Armbruster
2016-08-23  9:27 ` [Qemu-devel] [PATCH v2 4/5] megasas: remove unnecessary megasas_use_msix() Cao jin
2016-08-23  9:27 ` [Qemu-devel] [PATCH v2 5/5] megasas: undo the overwrites of user configuration Cao jin
2016-09-06 12:42 ` [Qemu-devel] [PATCH v2 0/5] Convert msix_init() to error Cao jin

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=20160913084911.5fd310ee@t450s.home \
    --to=alex.williamson@redhat.com \
    --cc=armbru@redhat.com \
    --cc=caoj.fnst@cn.fujitsu.com \
    --cc=marcel@redhat.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.