[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PULL for-2.10 6/7] xen/mapcache: introduce xen_replace
From: |
Stefano Stabellini |
Subject: |
Re: [Qemu-devel] [PULL for-2.10 6/7] xen/mapcache: introduce xen_replace_cache_entry() |
Date: |
Fri, 21 Jul 2017 17:28:12 -0700 (PDT) |
User-agent: |
Alpine 2.10 (DEB 1266 2009-07-14) |
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 <address@hidden>
> >
> > ...
> >
> > > +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.
- [Qemu-devel] [PULL for-2.0 0/7] please pull xen-20170718-tag, Stefano Stabellini, 2017/07/18
- [Qemu-devel] [PULL for-2.10 1/7] hw/xen: Set emu_mask for igd_opregion register, Stefano Stabellini, 2017/07/18
- [Qemu-devel] [PULL for-2.10 4/7] xen: move physmap saving into a separate function, Stefano Stabellini, 2017/07/18
- [Qemu-devel] [PULL for-2.10 2/7] xen_pt_msi.c: Check for xen_host_pci_get_* failures in xen_pt_msix_init(), Stefano Stabellini, 2017/07/18
- [Qemu-devel] [PULL for-2.10 5/7] xen/mapcache: add an ability to create dummy mappings, Stefano Stabellini, 2017/07/18
- [Qemu-devel] [PULL for-2.10 3/7] xen-platform: separate unplugging of NVMe disks, Stefano Stabellini, 2017/07/18
- [Qemu-devel] [PULL for-2.10 6/7] xen/mapcache: introduce xen_replace_cache_entry(), Stefano Stabellini, 2017/07/18
- [Qemu-devel] [PULL for-2.10 7/7] xen: don't use xenstore to save/restore physmap anymore, Stefano Stabellini, 2017/07/18
Re: [Qemu-devel] [PULL for-2.0 0/7] please pull xen-20170718-tag, Peter Maydell, 2017/07/19