kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Marco Elver" <elver@google.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH RFC 06/10] KVM: Add basic lock context annotations
Date: Thu, 10 Sep 2026 16:34:45 +0000	[thread overview]
Message-ID: <20260910163446.647251F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260910162343.4092060-7-elver@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Using `container_of` inside a lock annotation attribute causes capability expression parsing errors and function pointer context mismatch.
--

commit 5dd3470925b8b06c17b9c9055b2f5ae6c47704d3
Author: Marco Elver <elver@google.com>

KVM: Add basic lock context annotations

This commit adds basic static lock context annotations across common KVM
sources. It deliberately omits dynamic multi-lock acquisition paths.

> diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
> --- a/virt/kvm/eventfd.c
> +++ b/virt/kvm/eventfd.c
[ ... ]
> @@ -300,6 +301,7 @@ struct kvm_irqfd_pt {
>  
>  static void kvm_irqfd_register(struct file *file, wait_queue_head_t *wqh,
>  			       poll_table *pt)
> +	__must_hold_shared(&container_of(pt, struct kvm_irqfd_pt, pt)->kvm->irq_srcu)
>  {

[Severity: Low]
Does using container_of() inside a lock annotation attribute cause capability 
expression parsing errors?

When context analysis is enabled (for instance, building with
CONFIG_WARN_CONTEXT_ANALYSIS), using statement expressions like container_of()
inside lock attributes can lead to Clang Thread Safety Analysis dropping the
attribute or reporting a function pointer type mismatch. 

Could this be annotated differently, or perhaps the lock status assumed
inside the function body instead, to avoid using the macro inside the
attribute?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260910162343.4092060-1-elver@google.com?part=6

  reply	other threads:[~2026-09-10 16:34 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-10 16:21 [PATCH RFC 00/10] KVM: Enable Clang Context Analysis Marco Elver
2026-09-10 16:21 ` [PATCH RFC 01/10] KVM: x86/pmu: Acquire SRCU in pmc_is_event_allowed() to protect filter lookup Marco Elver
2026-09-10 16:46   ` Sean Christopherson
2026-09-10 16:21 ` [PATCH RFC 02/10] KVM: Allow reading memslots while holding slots_arch_lock Marco Elver
2026-09-10 16:30   ` Sean Christopherson
2026-09-10 17:11     ` Marco Elver
2026-09-10 17:52       ` Sean Christopherson
2026-09-10 19:05         ` Marco Elver
2026-09-10 16:39   ` sashiko-bot
2026-09-10 16:21 ` [PATCH RFC 03/10] KVM: guest_memfd: Avoid conditional mmu_lock acquisition Marco Elver
2026-09-10 16:42   ` sashiko-bot
2026-09-10 16:21 ` [PATCH RFC 04/10] KVM: Refactor kvm_handle_hva_range() to avoid conditional mmu_lock Marco Elver
2026-09-10 16:38   ` Sean Christopherson
2026-09-10 16:21 ` [PATCH RFC 05/10] KVM: Refactor kvm_handle_gfn_range() " Marco Elver
2026-09-10 16:21 ` [PATCH RFC 06/10] KVM: Add basic lock context annotations Marco Elver
2026-09-10 16:34   ` sashiko-bot [this message]
2026-09-10 16:53     ` Marco Elver
2026-09-10 16:21 ` [PATCH RFC 07/10] KVM: x86: " Marco Elver
2026-09-10 16:21 ` [PATCH RFC 08/10] KVM: Add guarded_by to members in struct kvm Marco Elver
2026-09-10 16:21 ` [PATCH RFC 09/10] KVM: x86: Add guarded_by annotations for kvm_arch, kvm_hv, and ioapic Marco Elver
2026-09-10 16:46   ` sashiko-bot
2026-09-10 16:21 ` [PATCH RFC 10/10] KVM: x86: Enable CONTEXT_ANALYSIS with opt-outs Marco Elver
2026-09-10 16:55 ` [PATCH RFC 00/10] KVM: Enable Clang Context Analysis Sean Christopherson
2026-09-10 19:19   ` Marco Elver

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=20260910163446.647251F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=elver@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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).