[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 3/9] xen/mm: move modify_identity_mmio to global file and drop __init



On Wed, Jun 21, 2017 at 06:51:32AM -0600, Jan Beulich wrote:
> >>> On 21.06.17 at 14:43, <roger.pau@xxxxxxxxxx> wrote:
> > On Wed, Jun 21, 2017 at 05:57:19AM -0600, Jan Beulich wrote:
> >> >>> On 21.06.17 at 13:11, <roger.pau@xxxxxxxxxx> wrote:
> >> > On Fri, May 19, 2017 at 07:35:39AM -0600, Jan Beulich wrote:
> >> >> >>> On 27.04.17 at 16:35, <roger.pau@xxxxxxxxxx> wrote:
> >> >> > +int modify_mmio(struct domain *d, gfn_t gfn, mfn_t mfn, unsigned 
> >> >> > long 
> > nr_pages,
> >> >> > +                const bool map)
> >> >> > +{
> >> >> > +    int rc;
> >> >> > +
> >> >> > +    /*
> >> >> > +     * Make sure this function is only used by the hardware domain, 
> > because it
> >> >> > +     * can take an arbitrary long time, and could DoS the whole 
> >> >> > system.
> >> >> > +     */
> >> >> > +    ASSERT(is_hardware_domain(d));
> >> >> 
> >> >> If that can happen arbitrarily at run time (rather than just at boot,
> >> >> as suggested by the removal of __init), it definitely can't remain as
> >> >> is and will instead need to make use of continuations. I'm therefore
> >> >> unconvinced you really want to move this code instead of simply
> >> >> calling {,un}map_mmio_regions() while taking care of preemption
> >> >> needs.
> >> > 
> >> > I'm not sure I know how to use continuations with non-hypercall
> >> > vmexits. Do you have any recommendations about how to do this? pause
> >> > the domain and run the mmio changes inside of a tasklet?
> >> 
> >> That would be one option. Or you could derive from the approach
> >> used for waiting for a response from the device model.
> > 
> > AFAICT the ioreq code pauses the domain and waits for a reply from the
> > dm, but in that case I would still need the tasklet in order to perform
> > the work (since there's no dm here).
> 
> Well, that's kind of pausing (it's not an explicit domain_pause(),
> and you really would mean to pause just the vCPU here).

Right, so vcpu_pause would do it.

> Otoh
> to prevent hangs we simply call process_pending_softirqs()
> every once in a while in a few other cases, so maybe doing that
> would already suffice here.

That's what I was doing here in modify_mmio, calling
process_pending_softirqs between calls to {map/unmap}_mmio_regions.

I could leave modify_identity_mmio as-is and simply call
{map/unmap}_mmio_regions from the vPCI header handlers, calling
process_pending_softirqs in between. I just moved the helper because
it avoids open-coding this again.

Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.