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

Re: [Xen-devel] [PULL for-2.10 6/7] xen/mapcache: introduce xen_replace_cache_entry()



On Fri, 21 Jul 2017, Igor Druzhinin wrote:
> On 21/07/17 14:50, Anthony PERARD wrote:
> > On Tue, Jul 18, 2017 at 03:22:41PM -0700, Stefano Stabellini wrote:
> > > From: Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>
> > 
> > ...
> > 
> > > +static uint8_t *xen_replace_cache_entry_unlocked(hwaddr old_phys_addr,
> > > +                                                 hwaddr new_phys_addr,
> > > +                                                 hwaddr size)
> > > +{
> > > +    MapCacheEntry *entry;
> > > +    hwaddr address_index, address_offset;
> > > +    hwaddr test_bit_size, cache_size = size;
> > > +
> > > +    address_index  = old_phys_addr >> MCACHE_BUCKET_SHIFT;
> > > +    address_offset = old_phys_addr & (MCACHE_BUCKET_SIZE - 1);
> > > +
> > > +    assert(size);
> > > +    /* test_bit_size is always a multiple of XC_PAGE_SIZE */
> > > +    test_bit_size = size + (old_phys_addr & (XC_PAGE_SIZE - 1));
> > > +    if (test_bit_size % XC_PAGE_SIZE) {
> > > +        test_bit_size += XC_PAGE_SIZE - (test_bit_size % XC_PAGE_SIZE);
> > > +    }
> > > +    cache_size = size + address_offset;
> > > +    if (cache_size % MCACHE_BUCKET_SIZE) {
> > > +        cache_size += MCACHE_BUCKET_SIZE - (cache_size %
> > > MCACHE_BUCKET_SIZE);
> > > +    }
> > > +
> > > +    entry = &mapcache->entry[address_index % mapcache->nr_buckets];
> > > +    while (entry && !(entry->paddr_index == address_index &&
> > > +                      entry->size == cache_size)) {
> > > +        entry = entry->next;
> > > +    }
> > > +    if (!entry) {
> > > +        DPRINTF("Trying to update an entry for %lx " \
> > > +                "that is not in the mapcache!\n", old_phys_addr);
> > > +        return NULL;
> > > +    }
> > > +
> > > +    address_index  = new_phys_addr >> MCACHE_BUCKET_SHIFT;
> > > +    address_offset = new_phys_addr & (MCACHE_BUCKET_SIZE - 1);
> > > +
> > > +    fprintf(stderr, "Replacing a dummy mapcache entry for %lx with
> > > %lx\n",
> > > +            old_phys_addr, new_phys_addr);
> > 
> > Looks likes this does not build on 32bits.
> > in:
> > http://logs.test-lab.xenproject.org/osstest/logs/112041/build-i386/6.ts-xen-build.log
> > 
> > /home/osstest/build.112041.build-i386/xen/tools/qemu-xen-dir/hw/i386/xen/xen-mapcache.c:
> > In function 'xen_replace_cache_entry_unlocked':
> > /home/osstest/build.112041.build-i386/xen/tools/qemu-xen-dir/hw/i386/xen/xen-mapcache.c:539:13:
> > error: format '%lx' expects argument of type 'long unsigned int', but
> > argument 3 has type 'hwaddr' [-Werror=format=]
> >               old_phys_addr, new_phys_addr);
> >               ^
> > /home/osstest/build.112041.build-i386/xen/tools/qemu-xen-dir/hw/i386/xen/xen-mapcache.c:539:13:
> > error: format '%lx' expects argument of type 'long unsigned int', but
> > argument 4 has type 'hwaddr' [-Werror=format=]
> > cc1: all warnings being treated as errors
> >    CC      i386-softmmu/target/i386/gdbstub.o
> > /home/osstest/build.112041.build-i386/xen/tools/qemu-xen-dir/rules.mak:66:
> > recipe for target 'hw/i386/xen/xen-mapcache.o' failed
> > 
> > > +
> > > +    xen_remap_bucket(entry, entry->vaddr_base,
> > > +                     cache_size, address_index, false);
> > > +    if (!test_bits(address_offset >> XC_PAGE_SHIFT,
> > > +                test_bit_size >> XC_PAGE_SHIFT,
> > > +                entry->valid_mapping)) {
> > > +        DPRINTF("Unable to update a mapcache entry for %lx!\n",
> > > old_phys_addr);
> > > +        return NULL;
> > > +    }
> > > +
> > > +    return entry->vaddr_base + address_offset;
> > > +}
> > > +
> > 
> 
> Please, accept the attached patch to fix the issue.

The patch looks good to me. I'll send it upstream.

_______________________________________________
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®.