From: Paolo Bonzini <pbonzini@redhat.com>
To: Hamza Mahfooz <someguy@effective-light.com>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
qemu-arm@nongnu.org, kvm@vger.kernel.org
Subject: Re: [PATCH] target/arm: kvm: use RCU_READ_LOCK_GUARD() in kvm_arch_fixup_msi_route()
Date: Wed, 28 Jul 2021 09:30:46 +0200 [thread overview]
Message-ID: <e84e3fe7-e644-7059-22cc-ddefd8bfc8c4@redhat.com> (raw)
In-Reply-To: <20210727235201.11491-1-someguy@effective-light.com>
On 28/07/21 01:52, Hamza Mahfooz wrote:
> As per commit 5626f8c6d468 ("rcu: Add automatically released rcu_read_lock
> variants"), RCU_READ_LOCK_GUARD() should be used instead of
> rcu_read_{un}lock().
>
> Signed-off-by: Hamza Mahfooz <someguy@effective-light.com>
> ---
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
> target/arm/kvm.c | 17 ++++++++---------
> 1 file changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/target/arm/kvm.c b/target/arm/kvm.c
> index d8381ba224..5d55de1a49 100644
> --- a/target/arm/kvm.c
> +++ b/target/arm/kvm.c
> @@ -998,7 +998,6 @@ int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route,
> hwaddr xlat, len, doorbell_gpa;
> MemoryRegionSection mrs;
> MemoryRegion *mr;
> - int ret = 1;
>
> if (as == &address_space_memory) {
> return 0;
> @@ -1006,15 +1005,19 @@ int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route,
>
> /* MSI doorbell address is translated by an IOMMU */
>
> - rcu_read_lock();
> + RCU_READ_LOCK_GUARD();
> +
> mr = address_space_translate(as, address, &xlat, &len, true,
> MEMTXATTRS_UNSPECIFIED);
> +
> if (!mr) {
> - goto unlock;
> + return 1;
> }
> +
> mrs = memory_region_find(mr, xlat, 1);
> +
> if (!mrs.mr) {
> - goto unlock;
> + return 1;
> }
>
> doorbell_gpa = mrs.offset_within_address_space;
> @@ -1025,11 +1028,7 @@ int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route,
>
> trace_kvm_arm_fixup_msi_route(address, doorbell_gpa);
>
> - ret = 0;
> -
> -unlock:
> - rcu_read_unlock();
> - return ret;
> + return 0;
> }
>
> int kvm_arch_add_msi_route_post(struct kvm_irq_routing_entry *route,
>
next prev parent reply other threads:[~2021-07-28 7:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-27 23:52 [PATCH] target/arm: kvm: use RCU_READ_LOCK_GUARD() in kvm_arch_fixup_msi_route() Hamza Mahfooz
2021-07-28 7:30 ` Paolo Bonzini [this message]
2021-08-13 16:17 ` Peter Maydell
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=e84e3fe7-e644-7059-22cc-ddefd8bfc8c4@redhat.com \
--to=pbonzini@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=someguy@effective-light.com \
/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).