From: sashiko-bot@kernel.org
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: kvm@vger.kernel.org, virtualization@lists.linux.dev,
"Eugenio Perez" <eperezma@redhat.com>
Subject: Re: [PATCH RFC] vhost: set dirty log bits without pinning pages on x86
Date: Sat, 14 Nov 2026 13:51:52 +0000 [thread overview]
Message-ID: <sashiko-outbox-214595@kernel.org> (raw)
In-Reply-To: <20261113083351-mutt-send-email-mst@kernel.org>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] vhost: missing drivers/vhost/vhost.c changes to use
set_bit_user()
- [Low] x86/uaccess: missing local __label__ efault in set_bit_user()
--
commit 0fc009f80e8e18bd72e753ada02155e494eedeca
Author: Michael S. Tsirkin <mst@redhat.com>
vhost: set dirty log bits without pinning pages on x86
This commit adds the set_bit_user() macro in arch/x86/include/asm/uaccess.h
to atomically set a bit in a byte of user memory using scoped_user_rw_access().
> diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
> index 3a0dd3c2b233e..0bffa43e02179 100644
> --- a/arch/x86/include/asm/uaccess.h
> +++ b/arch/x86/include/asm/uaccess.h
> @@ -594,6 +594,28 @@ _label: \
> __ret; \
> })
>
> +/* set_bit() on a byte of user memory; returns -EFAULT on fault. */
> +#define set_bit_user(nr, addr) \
[Severity: Medium]
Is this commit missing the changes in drivers/vhost/vhost.c to call
set_bit_user()?
The commit appears to have been applied directly from a mailing-list reply
that only contained a replacement hunk for arch/x86/include/asm/uaccess.h.
As a result, set_bit_user() has no callers in the tree and
set_bit_to_user() in drivers/vhost/vhost.c still pins user pages with
pin_user_pages_fast().
> +({ \
> + int __err = -EFAULT; \
> + u8 __user *__p = (addr); \
> + scoped_user_rw_access(__p, efault) { \
> + __err = 0; \
> + asm volatile("\n" \
> + "1: " LOCK_PREFIX "orb %[mask], %[ptr]\n" \
> + "2:\n" \
> + _ASM_EXTABLE_TYPE_REG(1b, 2b, \
> + EX_TYPE_EFAULT_REG, \
> + %[errout]) \
> + : [errout] "+r" (__err), \
> + [ptr] "+m" (*__p) \
> + : [mask] "q" ((unsigned char)BIT(nr)) \
> + : "memory", "cc"); \
> + } \
> +efault: \
> + __err; \
> +})
[Severity: Low]
Should set_bit_user() declare __label__ efault; at the start of the
statement expression, as get_user_inline() and put_user_inline() do in
include/linux/uaccess.h?
Without __label__ efault;, the efault label has function scope, so
expanding set_bit_user() more than once in the same function (or inside a
function that already defines an efault label) will fail to compile with a
duplicate label error.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261113083351-mutt-send-email-mst@kernel.org?part=1
next prev parent reply other threads:[~2026-11-14 13:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 10:53 [PATCH RFC] vhost: set dirty log bits without pinning pages on x86 Michael S. Tsirkin
2026-11-13 1:29 ` zhaoguohan
2026-11-13 5:47 ` Michael S. Tsirkin
2026-11-13 6:09 ` Michael S. Tsirkin
2026-11-13 13:51 ` Michael S. Tsirkin
2026-11-14 13:51 ` sashiko-bot [this message]
2026-11-13 10:54 ` sashiko-bot
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=sashiko-outbox-214595@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=eperezma@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=virtualization@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