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

Re: [Xen-devel] [PATCH v7 15/15] x86/hvm: track large memory mapped accesses by buffer offset


  • To: Jan Beulich <JBeulich@xxxxxxxx>
  • From: Paul Durrant <Paul.Durrant@xxxxxxxxxx>
  • Date: Thu, 9 Jul 2015 16:05:31 +0000
  • Accept-language: en-GB, en-US
  • Cc: "Keir \(Xen.org\)" <keir@xxxxxxx>, "xen-devel@xxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxx>
  • Delivery-date: Thu, 09 Jul 2015 16:05:42 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>
  • Thread-index: AQHQukn7ofK/1a5OQ0CvZ/pqCYlVo53TJp+AgAAmuPA=
  • Thread-topic: [PATCH v7 15/15] x86/hvm: track large memory mapped accesses by buffer offset

> -----Original Message-----
> From: Jan Beulich [mailto:JBeulich@xxxxxxxx]
> Sent: 09 July 2015 16:46
> To: Paul Durrant
> Cc: xen-devel@xxxxxxxxxxxxx; Keir (Xen.org)
> Subject: Re: [PATCH v7 15/15] x86/hvm: track large memory mapped
> accesses by buffer offset
> 
> >>> On 09.07.15 at 15:10, <paul.durrant@xxxxxxxxxx> wrote:
> > @@ -635,13 +605,49 @@ static int hvmemul_phys_mmio_access(
> >      return rc;
> >  }
> >
> > +/*
> > + * Multi-cycle MMIO handling is based upon the assumption that
> emulation
> > + * of the same instruction will not access the same MMIO region more
> > + * than once. Hence we can deal with re-emulation (for secondary or
> > + * subsequent cycles) by looking up the result or previous I/O in a
> > + * cache indexed by linear MMIO address.
> > + */
> > +static struct hvm_mmio_cache *hvmemul_find_mmio_cache(
> > +    struct hvm_vcpu_io *vio, unsigned long gla, uint8_t dir)
> > +{
> > +    unsigned int i;
> > +    struct hvm_mmio_cache *cache;
> > +
> > +    for ( i = 0; i < vio->mmio_cache_count; i ++ )
> > +    {
> > +        cache = &vio->mmio_cache[i];
> > +
> > +        if ( gla == cache->gla &&
> > +             dir == cache->dir )
> > +            return cache;
> > +    }
> > +
> > +    i = vio->mmio_cache_count++;
> > +    if( i == ARRAY_SIZE(vio->mmio_cache) )
> > +        domain_crash(current->domain);
> 
> But you mustn't continue here, or at least force i into range so you
> don't corrupt other data.
> 
> And while doing that please also add the missing space on the
> if() line.
> 

Sorry, I was forgetting domain_crash() is not immediate. I'll send v8.

  Paul

> Jan


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


 


Rackspace

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