From: Sean Christopherson <seanjc@google.com>
To: Ilias Stamatis <ilstam@amazon.com>
Cc: kvm@vger.kernel.org, pbonzini@redhat.com, pdurrant@amazon.co.uk,
dwmw@amazon.co.uk, nh-open-source@amazon.com,
Paul Durrant <paul@xen.org>
Subject: Re: [PATCH v2 2/6] KVM: Add KVM_CREATE_COALESCED_MMIO_BUFFER ioctl
Date: Fri, 16 Aug 2024 17:32:35 -0700 [thread overview]
Message-ID: <Zr_voxMsDyHdZmxx@google.com> (raw)
In-Reply-To: <20240718193543.624039-3-ilstam@amazon.com>
On Thu, Jul 18, 2024, Ilias Stamatis wrote:
> @@ -40,17 +42,14 @@ static int coalesced_mmio_in_range(struct kvm_coalesced_mmio_dev *dev,
> return 1;
> }
>
> -static int coalesced_mmio_has_room(struct kvm_coalesced_mmio_dev *dev, u32 last)
> +static int coalesced_mmio_has_room(struct kvm_coalesced_mmio_ring *ring, u32 last)
> {
> - struct kvm_coalesced_mmio_ring *ring;
> -
> /* Are we able to batch it ? */
>
> /* last is the first free entry
> * check if we don't meet the first used entry
> * there is always one unused entry in the buffer
> */
> - ring = dev->kvm->coalesced_mmio_ring;
> if ((last + 1) % KVM_COALESCED_MMIO_MAX == READ_ONCE(ring->first)) {
> /* full */
> return 0;
> @@ -65,17 +64,28 @@ static int coalesced_mmio_write(struct kvm_vcpu *vcpu,
> {
> struct kvm_coalesced_mmio_dev *dev = to_mmio(this);
> struct kvm_coalesced_mmio_ring *ring = dev->kvm->coalesced_mmio_ring;
> + spinlock_t *lock = dev->buffer_dev ?
> + &dev->buffer_dev->ring_lock :
> + &dev->kvm->ring_lock;
I'd prefer
spinlock_t *lock = dev->buffer_dev ? &dev->buffer_dev->ring_lock :
&dev->kvm->ring_lock;
to make it more obvious which parts the "guts" of the effective if-statement.
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index d0788d0a72cc..9eb22287384f 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -5246,6 +5246,10 @@ static long kvm_vm_ioctl(struct file *filp,
> r = kvm_vm_ioctl_unregister_coalesced_mmio(kvm, &zone);
> break;
> }
> + case KVM_CREATE_COALESCED_MMIO_BUFFER: {
Curly braces aren't needed, the above case has 'em because it declares local
variables.
> + r = kvm_vm_ioctl_create_coalesced_mmio_buffer(kvm);
> + break;
> + }
> #endif
> case KVM_IRQFD: {
> struct kvm_irqfd data;
> --
> 2.34.1
>
next prev parent reply other threads:[~2024-08-17 0:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-18 19:35 [PATCH v2 0/6] KVM: Improve MMIO Coalescing API Ilias Stamatis
2024-07-18 19:35 ` [PATCH v2 1/6] KVM: Fix coalesced_mmio_has_room() Ilias Stamatis
2024-07-18 19:35 ` [PATCH v2 2/6] KVM: Add KVM_CREATE_COALESCED_MMIO_BUFFER ioctl Ilias Stamatis
2024-08-17 0:32 ` Sean Christopherson [this message]
2024-07-18 19:35 ` [PATCH v2 3/6] KVM: Support poll() on coalesced mmio buffer fds Ilias Stamatis
2024-07-20 1:35 ` kernel test robot
2024-07-22 14:26 ` Stamatis, Ilias
2024-07-20 21:10 ` kernel test robot
2024-07-18 19:35 ` [PATCH v2 4/6] KVM: Add KVM_(UN)REGISTER_COALESCED_MMIO2 ioctls Ilias Stamatis
2024-08-17 0:36 ` Sean Christopherson
2024-07-18 19:35 ` [PATCH v2 5/6] KVM: Documentation: Document v2 of coalesced MMIO API Ilias Stamatis
2024-07-18 19:35 ` [PATCH v2 6/6] KVM: selftests: Add coalesced_mmio_test Ilias Stamatis
2024-08-17 0:40 ` [PATCH v2 0/6] KVM: Improve MMIO Coalescing API Sean Christopherson
2024-08-23 23:47 ` Sean Christopherson
2024-08-27 10:35 ` Stamatis, Ilias
2024-08-27 13:45 ` Sean Christopherson
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=Zr_voxMsDyHdZmxx@google.com \
--to=seanjc@google.com \
--cc=dwmw@amazon.co.uk \
--cc=ilstam@amazon.com \
--cc=kvm@vger.kernel.org \
--cc=nh-open-source@amazon.com \
--cc=paul@xen.org \
--cc=pbonzini@redhat.com \
--cc=pdurrant@amazon.co.uk \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).