All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	Andrew Cooper <andrew.cooper3@citrix.com>
Subject: Re: [PATCH v2 5/5] x86/HVM: drop redundant access splitting
Date: Thu, 23 Jan 2025 10:01:13 +0100	[thread overview]
Message-ID: <Z5IFWQLbhCBk4XxY@macbook.local> (raw)
In-Reply-To: <7d73f0c5-3d16-4cf3-b8de-e45f539e8916@suse.com>

On Tue, Oct 01, 2024 at 10:50:25AM +0200, Jan Beulich wrote:
> With all paths into hvmemul_linear_mmio_access() coming through
> linear_{read,write}(), there's no need anymore to split accesses at
> page boundaries there. Leave an assertion, though.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> ---
> v2: Replace ASSERT() by more safe construct.
> 
> --- a/xen/arch/x86/hvm/emulate.c
> +++ b/xen/arch/x86/hvm/emulate.c
> @@ -1084,7 +1084,7 @@ static int hvmemul_linear_mmio_access(
>  {
>      struct hvm_vcpu_io *hvio = &current->arch.hvm.hvm_io;
>      unsigned long offset = gla & ~PAGE_MASK;
> -    unsigned int chunk, buffer_offset = gla - start;
> +    unsigned int buffer_offset = gla - start;
>      struct hvm_mmio_cache *cache = hvmemul_find_mmio_cache(hvio, start, dir,
>                                                             buffer_offset);
>      paddr_t gpa;
> @@ -1094,13 +1094,17 @@ static int hvmemul_linear_mmio_access(
>      if ( cache == NULL )
>          return X86EMUL_UNHANDLEABLE;
>  
> -    chunk = min_t(unsigned int, size, PAGE_SIZE - offset);
> +    if ( size > PAGE_SIZE - offset )

FWIW, I find this easier to read as `size + offset > PAGE_SIZE` (which
is the same condition used in linear_{read,write}().

Preferably with that adjusted:

Acked-by: Roger Pau Monné <roger.pau@citrix.com>

Thanks, Roger.


  reply	other threads:[~2025-01-23  9:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-01  8:47 [PATCH v2 0/5] x86/HVM: emulation (MMIO) improvements Jan Beulich
2024-10-01  8:48 ` [PATCH v2 1/5] x86/HVM: correct MMIO emulation cache bounds check Jan Beulich
2025-01-22 10:44   ` Roger Pau Monné
2024-10-01  8:49 ` [PATCH v2 2/5] x86/HVM: allocate emulation cache entries dynamically Jan Beulich
2025-01-22 12:00   ` Roger Pau Monné
2025-01-22 13:39     ` Jan Beulich
2025-01-22 17:47       ` Roger Pau Monné
2024-10-01  8:49 ` [PATCH v2 3/5] x86/HVM: correct read/write split at page boundaries Jan Beulich
2025-01-22 17:45   ` Roger Pau Monné
2025-01-23  9:49     ` Jan Beulich
2025-01-23 12:23       ` Roger Pau Monné
2024-10-01  8:50 ` [PATCH v2 4/5] x86/HVM: slightly improve CMPXCHG16B emulation Jan Beulich
2024-10-01  8:50 ` [PATCH v2 5/5] x86/HVM: drop redundant access splitting Jan Beulich
2025-01-23  9:01   ` Roger Pau Monné [this message]
2025-01-23  9:20     ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z5IFWQLbhCBk4XxY@macbook.local \
    --to=roger.pau@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.