From: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
To: sashiko-reviews@lists.linux.dev
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v5 1/9] KVM: PPC: selftests: add support for powerpc
Date: Tue, 29 Sep 2026 06:41:49 +0530 [thread overview]
Message-ID: <qzickgiy.ritesh.list@gmail.com> (raw)
In-Reply-To: <20260922184312.9FAAB1F000FF@smtp.kernel.org>
sashiko-bot@kernel.org writes:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] kvm: selftests: missing save/restore of %r1 and %r2 in ex_regs
> --
>
> commit 2e259a0445aae14d6a7262b100f4677735b2217f
> Author: Nicholas Piggin <npiggin@gmail.com>
>
> KVM: PPC: selftests: add support for powerpc
>
> This commit implements KVM selftests support for powerpc (Book3S-64). It
> provides virtual memory implementation for the radix MMU, ucalls using an
> unsupported PAPR hcall number, and real-mode guest interrupts.
>
> Link: https://lore.kernel.org/linuxppc-dev/cover.1781093720.git.ritesh.list@gmail.com/
>
>> diff --git a/tools/testing/selftests/kvm/lib/powerpc/handlers.S b/tools/testing/selftests/kvm/lib/powerpc/handlers.S
>> new file mode 100644
>> index 0000000000000..b860f6a520a13
>> --- /dev/null
>> +++ b/tools/testing/selftests/kvm/lib/powerpc/handlers.S
>
> [ ... ]
>
>> +virt_handle_interrupt:
>> + stdu %r1,-INT_FRAME_SIZE(%r1)
>> + mr %r3,%r31
>
> [ ... ]
>
>> + mtxer %r8
>> + mtcr %r9
>> +reg=4
>> + ld %r0,(0*8)(%r31)
>> + ld %r3,(3*8)(%r31)
>> +.rept 28
>> + ld reg,(reg*8)(%r31)
>> + reg=reg+1
>> +.endr
>
> [Severity: Medium]
> Does this restore loop in virt_handle_interrupt intentionally skip restoring
> %r1 (stack pointer) and %r2 (TOC base)?
>
> Because the loop starts at reg=4 and ends at %r31, any changes made to the
> stack pointer or TOC base by the C exception handler in the ex_regs
> structure will be silently ignored when returning to the guest.
>
That is intentional since it is unnecessary.
>> + addi %r1,%r1,INT_FRAME_SIZE
>> + rfid
>> +
>> +virt_handle_interrupt_p:
>> + .llong virt_handle_interrupt
>> +
>> +handle_interrupt:
>> +reg=4
>> +.rept 28
>> + std reg,(reg*8)(%r13)
>> + reg=reg+1
>> +.endr
>
> [Severity: Medium]
> Similarly, does handle_interrupt skip saving %r1 and %r2 into the ex_regs
> structure before routing to the C handler?
>
> If a selftest takes an exception and attempts to inspect the interrupted
> stack or TOC by reading regs->gprs[1] or regs->gprs[2], won't it receive
> uninitialized values instead of the actual register states?
>
ditto. None of the tests depend on it.
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/cover.1790101179.git.ritesh.list@gmail.com?part=1
next prev parent reply other threads:[~2026-09-29 1:33 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 18:28 [PATCH v5 0/9] KVM: selftests: add powerpc support Ritesh Harjani (IBM)
2026-09-22 18:28 ` [PATCH v5 1/9] KVM: PPC: selftests: add support for powerpc Ritesh Harjani (IBM)
2026-09-22 18:43 ` sashiko-bot
2026-09-29 1:11 ` Ritesh Harjani [this message]
2026-10-02 22:12 ` Sean Christopherson
2026-10-03 4:37 ` Ritesh Harjani
2026-09-22 18:28 ` [PATCH v5 2/9] KVM: selftests: Enable kvm_create_max_vcpus test " Ritesh Harjani (IBM)
2026-09-22 18:28 ` [PATCH v5 3/9] KVM: selftests: Don't limit LE dirty-bitmap bitops to s390x Ritesh Harjani (IBM)
2026-09-22 18:28 ` [PATCH v5 4/9] KVM: selftests: Split out a KVM_CREATE_VCPU helper that can fail Ritesh Harjani (IBM)
2026-09-22 18:28 ` [PATCH v5 5/9] KVM: selftests: Make kvm_create_max_vcpus tolerate ENOMEM Ritesh Harjani (IBM)
2026-10-02 22:16 ` Sean Christopherson
2026-10-03 5:45 ` Ritesh Harjani
2026-09-22 18:28 ` [PATCH v5 6/9] KVM: selftests: Limit the number of VM creates in hardware_disable_test Ritesh Harjani (IBM)
2026-10-02 22:19 ` Sean Christopherson
2026-10-03 6:01 ` Ritesh Harjani
2026-09-22 18:28 ` [PATCH v5 7/9] KVM: PPC: selftests: Make nested case on pseries LPARs as resource constrained Ritesh Harjani (IBM)
2026-09-22 18:28 ` [PATCH v5 8/9] KVM: PPC: selftests: Skip idle-page check when running nested on pseries LPAR Ritesh Harjani (IBM)
2026-09-22 18:28 ` [PATCH v5 9/9] KVM: selftests: Move memslot_perf_test off the 256M ELF load address Ritesh Harjani (IBM)
2026-10-02 22:28 ` Sean Christopherson
2026-09-29 1:35 ` [PATCH v5 0/9] KVM: selftests: add powerpc support Ritesh Harjani
2026-10-02 22:38 ` Sean Christopherson
2026-10-03 6:46 ` Ritesh Harjani
2026-10-05 2:39 ` Sean Christopherson
2026-10-05 4:25 ` Ritesh Harjani
2026-10-05 6:08 ` Sean Christopherson
2026-10-06 2:43 ` Ritesh Harjani
2026-09-29 5:49 ` Anushree Mathur
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=qzickgiy.ritesh.list@gmail.com \
--to=ritesh.list@gmail.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