From: Paolo Bonzini <pbonzini@redhat.com>
To: Hao Peng <flyingpenghao@gmail.com>,
Sean Christopherson <seanjc@google.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: use unified srcu interface function
Date: Fri, 23 Dec 2022 16:32:53 +0100 [thread overview]
Message-ID: <365fe273-ba11-eb12-4d80-a2e6a17bf0fa@redhat.com> (raw)
In-Reply-To: <CAPm50aJv2_6321BgLXB6SWH1CcoYM4733fsovtB_5zhoP_7x+Q@mail.gmail.com>
On 12/20/22 08:47, Hao Peng wrote:
>>> + old = srcu_dereference_check(kvm->irq_routing, &kvm->irq_srcu,
>>> + lockdep_is_held(&kvm->irq_lock));
>> Readers of irq_routing are protected via kvm->irq_srcu, but this writer is never
>> called with kvm->irq_srcu held. I do like the of replacing '1' with
>> lockdep_is_held(&kvm->irq_lock) to document the protection, so what about just
>> doing that? I.e.
>>
> Sorry for the long delay in replying. Although kvm->irq_srcu is not required
> to protect irq_routing here, this interface function srcu_dereference_check
> indicates that irq_routing is protected by kvm->irq_srcu in the kvm subsystem.
> Thanks.
>
I agree, the last two arguments basically are alternative conditions to
satisfy the check:
#define srcu_dereference_check(p, ssp, c) \
__rcu_dereference_check((p), __UNIQUE_ID(rcu), \
(c) || srcu_read_lock_held(ssp), __rcu)
The idea is to share the code between readers and writers, so what do
you think of adding a
#define kvm_get_irq_routing(kvm) srcu_dereference_check(...)
macro at the top of virt/kvm/irqchip.c?
Thanks,
Paolo
next prev parent reply other threads:[~2022-12-23 15:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-08 1:19 Hao Peng
2022-12-09 1:22 ` Sean Christopherson
2022-12-20 7:47 ` Hao Peng
2022-12-23 15:32 ` Paolo Bonzini [this message]
2023-01-04 1:19 ` 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=365fe273-ba11-eb12-4d80-a2e6a17bf0fa@redhat.com \
--to=pbonzini@redhat.com \
--cc=flyingpenghao@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=seanjc@google.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
all inboxes | Powered by JetHome®