qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v4 08/17] xen: mapcache: Refactor xen_invalidate_map_cache_en


From: Stefano Stabellini
Subject: Re: [PATCH v4 08/17] xen: mapcache: Refactor xen_invalidate_map_cache_entry_unlocked
Date: Wed, 1 May 2024 13:47:06 -0700 (PDT)
User-agent: Alpine 2.22 (DEB 394 2020-01-19)

On Tue, 30 Apr 2024, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@amd.com>
> 
> Add MapCache argument to xen_invalidate_map_cache_entry_unlocked.
> This is in preparation for supporting multiple map caches.
> 
> No functional changes.
> 
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
>  hw/xen/xen-mapcache.c | 21 +++++++++++----------
>  1 file changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/hw/xen/xen-mapcache.c b/hw/xen/xen-mapcache.c
> index 6e758eff94..34454da2f6 100644
> --- a/hw/xen/xen-mapcache.c
> +++ b/hw/xen/xen-mapcache.c
> @@ -420,7 +420,8 @@ ram_addr_t xen_ram_addr_from_mapcache(void *ptr)
>      return xen_ram_addr_from_mapcache_single(mapcache, ptr);
>  }
>  
> -static void xen_invalidate_map_cache_entry_unlocked(uint8_t *buffer)
> +static void xen_invalidate_map_cache_entry_unlocked(MapCache *mc,
> +                                                    uint8_t *buffer)
>  {
>      MapCacheEntry *entry = NULL, *pentry = NULL;
>      MapCacheRev *reventry;
> @@ -428,7 +429,7 @@ static void 
> xen_invalidate_map_cache_entry_unlocked(uint8_t *buffer)
>      hwaddr size;
>      int found = 0;
>  
> -    QTAILQ_FOREACH(reventry, &mapcache->locked_entries, next) {
> +    QTAILQ_FOREACH(reventry, &mc->locked_entries, next) {
>          if (reventry->vaddr_req == buffer) {
>              paddr_index = reventry->paddr_index;
>              size = reventry->size;
> @@ -438,7 +439,7 @@ static void 
> xen_invalidate_map_cache_entry_unlocked(uint8_t *buffer)
>      }
>      if (!found) {
>          trace_xen_invalidate_map_cache_entry_unlocked_not_found(buffer);
> -        QTAILQ_FOREACH(reventry, &mapcache->locked_entries, next) {
> +        QTAILQ_FOREACH(reventry, &mc->locked_entries, next) {
>              trace_xen_invalidate_map_cache_entry_unlocked_found(
>                  reventry->paddr_index,
>                  reventry->vaddr_req
> @@ -446,15 +447,15 @@ static void 
> xen_invalidate_map_cache_entry_unlocked(uint8_t *buffer)
>          }
>          return;
>      }
> -    QTAILQ_REMOVE(&mapcache->locked_entries, reventry, next);
> +    QTAILQ_REMOVE(&mc->locked_entries, reventry, next);
>      g_free(reventry);
>  
> -    if (mapcache->last_entry != NULL &&
> -        mapcache->last_entry->paddr_index == paddr_index) {
> -        mapcache->last_entry = NULL;
> +    if (mc->last_entry != NULL &&
> +        mc->last_entry->paddr_index == paddr_index) {
> +        mc->last_entry = NULL;
>      }
>  
> -    entry = &mapcache->entry[paddr_index % mapcache->nr_buckets];
> +    entry = &mc->entry[paddr_index % mc->nr_buckets];
>      while (entry && (entry->paddr_index != paddr_index || entry->size != 
> size)) {
>          pentry = entry;
>          entry = entry->next;
> @@ -488,7 +489,7 @@ static void xen_invalidate_map_cache_entry_bh(void 
> *opaque)
>      XenMapCacheData *data = opaque;
>  
>      mapcache_lock(mapcache);
> -    xen_invalidate_map_cache_entry_unlocked(data->buffer);
> +    xen_invalidate_map_cache_entry_unlocked(mapcache, data->buffer);
>      mapcache_unlock(mapcache);
>  
>      aio_co_wake(data->co);
> @@ -506,7 +507,7 @@ void coroutine_mixed_fn 
> xen_invalidate_map_cache_entry(uint8_t *buffer)
>          qemu_coroutine_yield();
>      } else {
>          mapcache_lock(mapcache);
> -        xen_invalidate_map_cache_entry_unlocked(buffer);
> +        xen_invalidate_map_cache_entry_unlocked(mapcache, buffer);
>          mapcache_unlock(mapcache);
>      }
>  }
> -- 
> 2.40.1
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]