[RFC PATCH 04/31] Add GHCB allocations and helpers

2025-02-28 Thread Neeraj Upadhyay
: Michael Roth Cc: k...@vger.kernel.org Cc: linux-kselft...@vger.kernel.org Signed-off-by: Peter Gonda Signed-off-by: Neeraj Upadhyay --- tools/testing/selftests/kvm/include/x86/sev.h | 1 + .../testing/selftests/kvm/lib/x86/processor.c | 9 +++ tools/testing/selftests/kvm/lib/x86/sev.c | 78

[RFC PATCH 25/31] KVM: selftests: Add Secure AVIC APIC regs test

2025-02-28 Thread Neeraj Upadhyay
APIC updates done by guest are propagated to host for unaccelerated APIC registers. For accelerated APIC registers, updates are not propagated to host. Signed-off-by: Neeraj Upadhyay --- tools/testing/selftests/kvm/Makefile.kvm | 1 + .../testing/selftests/kvm/include/x86/savic.h

[RFC PATCH 31/31] KVM: selftests: Add MSI injection test for SAVIC

2025-02-28 Thread Neeraj Upadhyay
Extend SAVIC test include MSI injection from host. Test scenarios where MSI vector is not allowed by guest in ALLOWED_IRR and when it is allowed. Signed-off-by: Neeraj Upadhyay --- tools/testing/selftests/kvm/x86/savic_test.c | 49 1 file changed, 49 insertions(+) diff

[RFC PATCH 30/31] KVM: selftests: Add NMI test for SAVIC guests

2025-02-28 Thread Neeraj Upadhyay
Extend SAVIC test with various NMI tests: - Test NMI injection failure when AllowedNMI is not set by guest. - Test NMI injection when 2 NMIs are pending. - Test ICR based cross-VCPU NMI for fixed-phys, fixed-logical, broadcast-all and broadcast-exclself modes. Signed-off-by: Neeraj Upadhyay

[RFC PATCH 29/31] KVM: selftests: Add cross-vCPU IPI testing for SAVIC guests

2025-02-28 Thread Neeraj Upadhyay
Extend SAVIC test to include various cross-vCPU IPI modes - fixed dest, fixed-logical, broadcast-all, broadcast excluding self. Signed-off-by: Neeraj Upadhyay --- tools/testing/selftests/kvm/x86/savic_test.c | 305 ++- 1 file changed, 299 insertions(+), 6 deletions(-) diff

[RFC PATCH 28/31] KVM: selftests: Add IOAPIC tests for Secure AVIC

2025-02-28 Thread Neeraj Upadhyay
Extend Secure AVIC tests to test edge and level ioapic based interrupt flow. In addition, test RTC_GSI IOAPIC line which has special casing in KVM. Add new interfaces to read and write to IOAPIC redirect tables. Signed-off-by: Neeraj Upadhyay --- .../testing/selftests/kvm/include/kvm_util.h

[RFC PATCH 27/31] KVM: selftests: Extend savic test with idle halt testing

2025-02-28 Thread Neeraj Upadhyay
-by: Neeraj Upadhyay --- tools/testing/selftests/kvm/x86/savic_test.c | 57 +++- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/kvm/x86/savic_test.c b/tools/testing/selftests/kvm/x86/savic_test.c index 8cba7a81bce2..5c52254f7b1c 100644 --- a

[RFC PATCH 26/31] KVM: selftests: Add test to verify APIC MSR accesses for SAVIC guest

2025-02-28 Thread Neeraj Upadhyay
Extend SAVIC test to verify APIC MSR accesses in SAVIC enabled mode. Verify the behavior of reads and writes using rdmsr/wrmsr for various APIC registers. In addition, test whether wrmsr based writes are propagated to guest backing page. Signed-off-by: Neeraj Upadhyay --- .../testing/selftests

[RFC PATCH 24/31] KVM: selftests: Add Secure AVIC mode to xapic_ipi_test

2025-02-28 Thread Neeraj Upadhyay
Test cross-vCPU IPI for Secure AVIC guests using xapic_ipi_test. Add new "SAVIC" apic mode to the test for this. Signed-off-by: Neeraj Upadhyay --- tools/arch/x86/include/asm/msr-index.h| 4 +- .../selftests/kvm/include/x86/processor.h | 1 + .../selftests/kvm/x86/xapic_

[RFC PATCH 07/31] KVM: selftests: Fix ghcb_entry returned in ghcb_alloc()

2025-02-28 Thread Neeraj Upadhyay
Currently, ghcb_alloc() always returns first entry. Fix it to return an unused entry. Signed-off-by: Neeraj Upadhyay --- tools/testing/selftests/kvm/lib/x86/sev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/testing/selftests/kvm/lib/x86/sev.c b/tools/testing

[RFC PATCH 23/31] KVM: selftests: Add SAVIC GPA notification GHCB call

2025-02-28 Thread Neeraj Upadhyay
Add GHCB call to register Secure AVIC guest APIC backing page GPA with the hyperversior. This call ensures that guest APIC backing page is pinned in NPT while vCPU is running. Signed-off-by: Neeraj Upadhyay --- tools/testing/selftests/kvm/include/x86/sev.h | 1 + tools/testing/selftests/kvm

[RFC PATCH 22/31] KVM: selftests: Add args param to kvm_arch_vm_post_create()

2025-02-28 Thread Neeraj Upadhyay
Add provision to pass custom args to kvm_arch_vm_post_create(). This will be used to pass sev init args (vmsa features) for SEV VMs. Signed-off-by: Neeraj Upadhyay --- .../testing/selftests/kvm/include/kvm_util.h | 9 +++- tools/testing/selftests/kvm/include/x86/sev.h | 3 ++ tools/testing

[RFC PATCH 10/31] KVM: selftests: Add MSR VC handling support for SEV-ES VMs

2025-02-28 Thread Neeraj Upadhyay
Add #VC exception handling on rdmsr/wrmsr accesses for SEV-ES guests. In addition, add PV interface for direct msr read/write from SEV-ES guests without going through #VC exception path. Signed-off-by: Neeraj Upadhyay --- tools/testing/selftests/kvm/include/x86/sev.h | 2 + tools/testing

[RFC PATCH 02/31] Add arch specific additional guest pages

2025-02-28 Thread Neeraj Upadhyay
Christopherson Cc: Carlos Bilbao Cc: Tom Lendacky Cc: Michael Roth Cc: k...@vger.kernel.org Cc: linux-kselft...@vger.kernel.org Signed-off-by: Peter Gonda Signed-off-by: Neeraj Upadhyay --- tools/testing/selftests/kvm/include/kvm_util.h | 2 ++ tools/testing/selftests/kvm/lib/kvm_util.c | 16

[RFC PATCH 21/31] KVM: selftests: Add IPI handling support for Secure AVIC

2025-02-28 Thread Neeraj Upadhyay
writes are supported. Signed-off-by: Neeraj Upadhyay --- tools/testing/selftests/kvm/lib/x86/savic.c | 112 1 file changed, 112 insertions(+) diff --git a/tools/testing/selftests/kvm/lib/x86/savic.c b/tools/testing/selftests/kvm/lib/x86/savic.c index 141d31637e51..8259f7521e73

[RFC PATCH 20/31] KVM: selftests: Add unaccelerated APIC msrs #VC handling

2025-02-28 Thread Neeraj Upadhyay
Add #VC exception handling support for unaccelerated msrs reads/writes for Secure AVIC guests. Signed-off-by: Neeraj Upadhyay --- .../testing/selftests/kvm/include/x86/apic.h | 1 + .../testing/selftests/kvm/include/x86/savic.h | 1 + tools/testing/selftests/kvm/lib/x86/savic.c | 145

[RFC PATCH 19/31] KVM: selftests: Add Secure AVIC lib

2025-02-28 Thread Neeraj Upadhyay
Add Secure AVIC lib which provides apis to enable Secure AVIC for a vCPU. In addition, add guest APIC backing page initialization support and helper functions to access APIC regs from guest APIC backing page and from hv. Signed-off-by: Neeraj Upadhyay --- tools/testing/selftests/kvm

[RFC PATCH 18/31] KVM: selftests: Add SEV VM support in xapic_ipi_test

2025-02-28 Thread Neeraj Upadhyay
Add support to test SEV VMs - SEV, SEV-ES, SEV-SNP in both xapic and x2apic modes. Convert the stats page to a shared page so that it is accesible from host. Signed-off-by: Neeraj Upadhyay --- .../testing/selftests/kvm/include/kvm_util.h | 1 + tools/testing/selftests/kvm/lib/kvm_util.c

[RFC PATCH 17/31] KVM: selftests: Add x2apic mode testing in xapic_ipi_test

2025-02-28 Thread Neeraj Upadhyay
Add support for testing x2apic mode in xapic_ipi_test. This allows extending the test in future to support VMs which only work in x2apic mode such as Secure AVIC enabled VMs. Signed-off-by: Neeraj Upadhyay --- .../selftests/kvm/x86/xapic_ipi_test.c| 65 +++ 1 file

[RFC PATCH 16/31] KVM: selftests: Add SEV guests support in xapic_state_test

2025-02-28 Thread Neeraj Upadhyay
Now with xapic/x2apic acceses being supported for SEV-ES and SNP guests, add support for testing these VMs in xapic_state_test. Signed-off-by: Neeraj Upadhyay --- .../selftests/kvm/x86/xapic_state_test.c | 117 -- 1 file changed, 109 insertions(+), 8 deletions(-) diff

[RFC PATCH 15/31] KVM: selftests: Add instruction decoding for movabs instructions

2025-02-28 Thread Neeraj Upadhyay
Certain xapic MMIO reads and writes get compiled into movabs instruction which uses rax as the register containing data and 8-byte address encoded as part of the instruction. Add support to decode these instructions. Signed-off-by: Neeraj Upadhyay --- .../testing/selftests/kvm/lib/x86/insn

[RFC PATCH 14/31] KVM: selftests: Add MMIO VC exception handling for SEV-ES guests

2025-02-28 Thread Neeraj Upadhyay
Add MMIO VC exception handling support to allow xapic mmio access for SEV-ES guests. In addition, add a PV interface for xapic MMIO guest accesses from outside of VC exception handler context. Signed-off-by: Neeraj Upadhyay --- .../selftests/kvm/include/x86/ex_regs.h | 2 +- tools

[RFC PATCH 13/31] KVM: selftests: Add instruction decoding support

2025-02-28 Thread Neeraj Upadhyay
Update insn-eval.c to prototype instruction decoding for MMIO VC exception exit. Signed-off-by: Neeraj Upadhyay --- tools/testing/selftests/kvm/Makefile.kvm | 12 + .../selftests/kvm/include/x86/ex_regs.h | 21 ++ .../selftests/kvm/include/x86/insn-eval.h | 48

[RFC PATCH 12/31] KVM: selftests: Add instruction decoding support

2025-02-28 Thread Neeraj Upadhyay
-by: Neeraj Upadhyay --- tools/testing/selftests/kvm/.gitignore|3 +- .../testing/selftests/kvm/lib/x86/insn-eval.c | 1670 + 2 files changed, 1672 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/kvm/lib/x86/insn-eval.c diff --git a/tools/testing

[RFC PATCH 11/31] KVM: selftests: Skip vm_is_gpa_protected() call for APIC MMIO base

2025-02-28 Thread Neeraj Upadhyay
Skip vm_is_gpa_protected() call for APIC MMIO address in __virt_pg_map(). Without this change, the virt_pg_map() fails with below error for APIC MMIO address. No vm physical memory at 0xfee0 Signed-off-by: Neeraj Upadhyay --- tools/testing/selftests/kvm/lib/x86/processor.c | 6

[RFC PATCH 08/31] KVM: selftests: Make GHCB entry page size aligned

2025-02-28 Thread Neeraj Upadhyay
Make GHCB entry page size aligned. Without this change GHCB GPA registration gets incorrectly interpreted in host as a GHCB MSR protocol request. Signed-off-by: Neeraj Upadhyay --- tools/testing/selftests/kvm/lib/x86/sev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a

[RFC PATCH 01/31] Add GHCB with setters and getters

2025-02-28 Thread Neeraj Upadhyay
: Neeraj Upadhyay --- tools/testing/selftests/kvm/Makefile.kvm | 2 +- tools/testing/selftests/kvm/include/x86/svm.h | 106 ++ 2 files changed, 107 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/Makefile.kvm b/tools/testing/selftests/kvm/Makefile.kvm index

[RFC PATCH 00/31] AMD: Add Secure AVIC KVM selftests

2025-02-28 Thread Neeraj Upadhyay
estination shorthands for Secure AVIC enabled VM. - Patch 30 adds Hypervisor NMI injection and cross-vCPU ICR based NMI for Secure AVIC enabled VM. - Patch 31 adds MSI injection test for Secure AVIC enabled VM. Neeraj Upadhyay (25): KVM: selftests: Fix ghcb_entry returned in ghcb_alloc() KVM:

[RFC PATCH 09/31] KVM: selftests: Add support for #VC in x86 exception handlers

2025-02-28 Thread Neeraj Upadhyay
VC exception has an associated error code. Update the IDT handler for it. Signed-off-by: Neeraj Upadhyay --- tools/testing/selftests/kvm/lib/x86/handlers.S | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/lib/x86/handlers.S b/tools/testing

[RFC PATCH 06/31] Add ability for SEV-ES guests to use ucalls via GHCB

2025-02-28 Thread Neeraj Upadhyay
protocol. Cc: Vishal Annapurve Cc: Ackerley Tng Cc: Paolo Bonzini Cc: Claudio Imbrenda Cc: Sean Christopherson Cc: Carlos Bilbao Cc: Tom Lendacky Cc: Michael Roth Cc: k...@vger.kernel.org Cc: linux-kselft...@vger.kernel.org Signed-off-by: Peter Gonda Signed-off-by: Neeraj Upadhyay --- tools

[RFC PATCH 03/31] Add vm_vaddr_alloc_pages_shared()

2025-02-28 Thread Neeraj Upadhyay
...@vger.kernel.org Signed-off-by: Peter Gonda Signed-off-by: Neeraj Upadhyay --- tools/testing/selftests/kvm/include/kvm_util.h | 1 + tools/testing/selftests/kvm/lib/kvm_util.c | 6 ++ 2 files changed, 7 insertions(+) diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing

[RFC PATCH 05/31] Add is_sev_enabled() helpers

2025-02-28 Thread Neeraj Upadhyay
From: Peter Gonda Add helper functions for guest code to check the status of SEV and SEV-ES. Cc: Paolo Bonzini Cc: Claudio Imbrenda Cc: Sean Christopherson Cc: Carlos Bilbao Cc: Tom Lendacky Cc: Michael Roth Signed-off-by: Peter Gonda Signed-off-by: Neeraj Upadhyay --- tools/testing

Re: [PATCH v2] rcu/cpu_stall_cputime: fix the hardirq count for x86 architecture

2025-02-14 Thread Neeraj Upadhyay
tall diagnosis information") > Reported-by: kernel test robot > Closes: > https://lore.kernel.org/oe-kbuild-all/202501090842.sfi6qpgs-...@intel.com/ > Signed-off-by: Yongliang Gao Please move these tags above "---" of "Changes from v1:" section. Reviewed-by: Neer

Re: [PATCH v2 2/2] rcuscale: Remove redundant WARN_ON_ONCE() splat

2024-11-13 Thread Neeraj Upadhyay
ON_ONCE() splat which is in brackets. > > Reviewed-by: Paul E. McKenney > Signed-off-by: Uladzislau Rezki (Sony) > --- Reviewed-by: Neeraj Upadhyay - Neeraj

Re: [PATCH v2 1/2] rcuscale: Do a proper cleanup if kfree_scale_init() fails

2024-11-13 Thread Neeraj Upadhyay
Reviewed-by: Paul E. McKenney > Reported-by: Dan Carpenter > Closes: https://lore.kernel.org/rcu/ZxfTrHuEGtgnOYWp@pc636/T/ > Fixes: 084e04fff160 ("rcuscale: Add laziness and kfree tests") > Signed-off-by: Uladzislau Rezki (Sony) > --- Reviewed-by: Neeraj Upadhyay - Neeraj

Re: [PATCH 2/2] rcu/nocb: Fix missed RCU barrier on deoffloading

2024-11-12 Thread Neeraj Upadhyay
On 11/13/2024 3:07 AM, Frederic Weisbecker wrote: > Le Mon, Nov 11, 2024 at 01:07:16PM +0530, Neeraj Upadhyay a écrit : >> >>> diff --git a/kernel/rcu/tree_nocb.h b/kernel/rcu/tree_nocb.h >>> index 16865475120b..2605dd234a13 100644 >>> --- a/kernel/

Re: [PATCH rcu 11/15] rcutorture: Add reader_flavor parameter for SRCU readers

2024-11-12 Thread Neeraj Upadhyay
>>> >>> static int srcu_torture_read_lock(void) >>> { >>> - if (cur_ops == &srcud_ops) >>> - return srcu_read_lock_nmisafe(srcu_ctlp); >>> - else >>> - return srcu_read_lock(srcu_ctlp); >>> + int idx; >>> + int ret = 0; >>> + >>> + if ((reader_flavor & 0x1) || !(

Re: [PATCH rcu 11/15] rcutorture: Add reader_flavor parameter for SRCU readers

2024-11-11 Thread Neeraj Upadhyay
On 10/15/2024 9:41 PM, Paul E. McKenney wrote: > This commit adds an rcutorture.reader_flavor parameter whose bits > correspond to reader flavors. For example, SRCU's readers are 0x1 for > normal and 0x2 for NMI-safe. > > Signed-off-by: Paul E. McKenney > Cc: Alexei Starovoitov > Cc: Andrii Nak

Re: [PATCH v3 rcu 0/13] SRCU-lite changes for v6.13

2024-11-11 Thread Neeraj Upadhyay
t-weight SRCU scenario. > > 14. Add srcu_read_lock_lite() support using "srcu-lite". > > 15. Improve srcu_read_lock_lite() kernel-doc comment. > > Changes since v2: > > o Apply acked-by tag. > > o Split commit per Neeraj Upadhyay feedback. >

Re: [PATCH rcu 3/3] srcu: Unconditionally record srcu_read_lock_lite() in ->srcu_reader_flavor

2024-11-11 Thread Neeraj Upadhyay
;sda); > + > + if (likely(READ_ONCE(sdp->srcu_reader_flavor) & SRCU_READ_FLAVOR_LITE)) > + return; > + > + // Note that the cmpxchg() in srcu_check_read_flavor() is fully ordered. Nit: s/srcu_check_read_flavor/__srcu_check_read_flavor

Re: [PATCH rcu 2/3] srcu: Check for srcu_read_lock_lite() across all CPUs

2024-11-11 Thread Neeraj Upadhyay
tion that test the > SRCU_READ_FLAVOR_LITE bit in the resulting mask. > > Note that the srcu_readers_unlock_idx() function is already scanning all > the CPUs to sum up the ->srcu_unlock_count[] fields and that this is on > the grace-period slow path, hence no concerns about the sm

Re: [PATCH rcu 1/3] srcu: Remove smp_mb() from srcu_read_unlock_lite()

2024-11-11 Thread Neeraj Upadhyay
ommit therefore switches to __srcu_read_unlock_lite(). > > Reported-by: Neeraj Upadhyay > Closes: > https://lore.kernel.org/all/d07e8f4a-d5ff-4c8e-8e61-50db285c5...@amd.com/ > Fixes: c0f08d6b5a61 ("srcu: Add srcu_read_lock_lite() and > srcu_read_unlock_lite()") > S

Re: [PATCH rcu 06/12] srcu: Add srcu_read_lock_lite() and srcu_read_unlock_lite()

2024-11-11 Thread Neeraj Upadhyay
I am trying to understand the (unlikely) case where synchronize_srcu() is done before any srcu reader lock/unlock lite call is done. Can new SRCU readers fail to observe the updates? >>> >>> If a SRCU reader fail to observe the index flip, then isn't it the case >>> t

Re: [PATCH 0/6] RCU torture for v6.13

2024-11-11 Thread Neeraj Upadhyay
| 6 +++ > 5 files changed, 56 insertions(+), 27 deletions(-) > > Thanks. Reviewed-by: Neeraj Upadhyay - Neeraj

Re: [PATCH 0/2] RCU NOCB for v6.13

2024-11-11 Thread Neeraj Upadhyay
ed RCU barrier on deoffloading > > kernel/rcu/rcu_segcblist.h | 1 - > kernel/rcu/tree_nocb.h | 13 - > 2 files changed, 12 insertions(+), 2 deletions(-) > > Thanks. > Reviewed-by: Neeraj Upadhyay - Neeraj

Re: [PATCH 0/8] RCU fixes for v6.13

2024-11-11 Thread Neeraj Upadhyay
++ > 6 files changed, 27 insertions(+), 33 deletions(-) > For this series: Reviewed-by: Neeraj Upadhyay - Neeraj > Thanks.

Re: [PATCH rcu 06/12] srcu: Add srcu_read_lock_lite() and srcu_read_unlock_lite()

2024-11-11 Thread Neeraj Upadhyay
On 11/11/2024 8:56 PM, Paul E. McKenney wrote: > On Mon, Nov 11, 2024 at 06:24:58PM +0530, Neeraj Upadhyay wrote: >> >>> >>> /* >>> - * Returns approximate total of the readers' ->srcu_lock_count[] values >>> - * for the rank of per-CPU co

Re: [PATCH rcu 06/12] srcu: Add srcu_read_lock_lite() and srcu_read_unlock_lite()

2024-11-11 Thread Neeraj Upadhyay
> > /* > - * Returns approximate total of the readers' ->srcu_lock_count[] values > - * for the rank of per-CPU counters specified by idx. > + * Computes approximate total of the readers' ->srcu_lock_count[] values > + * for the rank of per-CPU counters specified by idx, and returns true if >

Re: [PATCH rcu 08/15] srcu: Add srcu_read_lock_lite() and srcu_read_unlock_lite()

2024-11-11 Thread Neeraj Upadhyay
> +/** > + * srcu_read_unlock_lite - unregister a old reader from an SRCU-protected > structure. > + * @ssp: srcu_struct in which to unregister the old reader. > + * @idx: return value from corresponding srcu_read_lock(). > + * > + * Exit a light-weight SRCU read-side critical section. > + */ >

Re: [PATCH 5/6] rcuscale: Do a proper cleanup if kfree_scale_init() fails

2024-11-11 Thread Neeraj Upadhyay
> diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c > index 6d37596deb1f..de7d511e6be4 100644 > --- a/kernel/rcu/rcuscale.c > +++ b/kernel/rcu/rcuscale.c > @@ -890,13 +890,13 @@ kfree_scale_init(void) > if (WARN_ON_ONCE(jiffies_at_lazy_cb - jif_start < 2 * HZ)) { >

Re: [PATCH 2/2] rcu/nocb: Fix missed RCU barrier on deoffloading

2024-11-10 Thread Neeraj Upadhyay
> diff --git a/kernel/rcu/tree_nocb.h b/kernel/rcu/tree_nocb.h > index 16865475120b..2605dd234a13 100644 > --- a/kernel/rcu/tree_nocb.h > +++ b/kernel/rcu/tree_nocb.h > @@ -891,7 +891,18 @@ static void nocb_cb_wait(struct rcu_data *rdp) > swait_event_interruptible_exclusive(rdp->nocb_cb_wq,

Re: [PATCH rcu 05/12] srcu: Standardize srcu_data pointers to "sdp" and similar

2024-10-14 Thread Neeraj Upadhyay
On 10/15/2024 5:59 AM, Paul E. McKenney wrote: > On Mon, Oct 14, 2024 at 09:49:52AM -0700, Paul E. McKenney wrote: >> On Mon, Oct 14, 2024 at 02:45:50PM +0530, Neeraj Upadhyay wrote: >>> On 10/9/2024 11:37 PM, Paul E. McKenney wrote: >>>> This commit changes a fe

Re: [PATCH rcu 04/12] srcu: Bit manipulation changes for additional reader flavor

2024-10-14 Thread Neeraj Upadhyay
On 10/14/2024 10:21 PM, Paul E. McKenney wrote: > On Mon, Oct 14, 2024 at 02:42:33PM +0530, Neeraj Upadhyay wrote: >> On 10/9/2024 11:37 PM, Paul E. McKenney wrote: >>> Currently, there are only two flavors of readers, normal and NMI-safe. >>> Very straightforward sta

Re: [PATCH rcu 03/12] srcu: Renaming in preparation for additional reader flavor

2024-10-14 Thread Neeraj Upadhyay
On 10/14/2024 10:22 PM, Paul E. McKenney wrote: > On Mon, Oct 14, 2024 at 02:40:35PM +0530, Neeraj Upadhyay wrote: >> On 10/9/2024 11:37 PM, Paul E. McKenney wrote: >>> Currently, there are only two flavors of readers, normal and NMI-safe. >>> A number of fields, f

Re: [PATCH rcu 05/12] srcu: Standardize srcu_data pointers to "sdp" and similar

2024-10-14 Thread Neeraj Upadhyay
On 10/9/2024 11:37 PM, Paul E. McKenney wrote: > This commit changes a few "cpuc" variables to "sdp" to align wiht usage > elsewhere. > s/wiht/with/ This commit is doing a lot more than renaming "cpuc". - Neeraj > Signed-off-by: Paul E. McKenney > Cc: Alexei Starovoitov > Cc: Andrii Nakryi

Re: [PATCH rcu 04/12] srcu: Bit manipulation changes for additional reader flavor

2024-10-14 Thread Neeraj Upadhyay
On 10/9/2024 11:37 PM, Paul E. McKenney wrote: > Currently, there are only two flavors of readers, normal and NMI-safe. > Very straightforward state updates suffice to check for erroneous > mixing of reader flavors on a given srcu_struct structure. This commit > upgrades the checking in preparatio

Re: [PATCH rcu 03/12] srcu: Renaming in preparation for additional reader flavor

2024-10-14 Thread Neeraj Upadhyay
On 10/9/2024 11:37 PM, Paul E. McKenney wrote: > Currently, there are only two flavors of readers, normal and NMI-safe. > A number of fields, functions, and types reflect this restriction. > This renaming-only commit prepares for the addition of light-weight > (as in memory-barrier-free) readers.

Re: [PATCH rcu 02/12] srcu: Introduce srcu_gp_is_expedited() helper function

2024-10-14 Thread Neeraj Upadhyay
Alexei Starovoitov > Cc: Andrii Nakryiko > Cc: Peter Zijlstra > Cc: Kent Overstreet > Cc: > --- Reviewed-by: Neeraj Upadhyay - Neeraj

Re: [PATCH rcu 01/12] srcu: Rename srcu_might_be_idle() to srcu_should_expedite()

2024-10-14 Thread Neeraj Upadhyay
of srcu_might_be_idle() to > srcu_should_expedite(), thus moving from what it currently does to why > it does it, this latter being more future-proof. > > Signed-off-by: Paul E. McKenney > Cc: Alexei Starovoitov > Cc: Andrii Nakryiko > Cc: Peter Zijlstra > Cc: Kent Overstreet > Cc: > --- Reviewed-by: Neeraj Upadhyay - Neeraj

[GIT PULL] RCU fix for v6.12

2024-10-11 Thread Neeraj Upadhyay
Hi Linus, The following changes since commit 8cf0b93919e13d1e8d4466eb4080a4c4d9d66d7b: Linux 6.12-rc2 (2024-10-06 15:32:27 -0700) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux.git tags/rcu.fixes.6.12-rc3 for you to fetch changes up to f734

[PATCH v2 10/10] rcu: Allow short-circuiting of synchronize_rcu_tasks_rude()

2024-10-09 Thread neeraj . upadhyay
Signed-off-by: Paul E. McKenney Cc: Peter Zijlstra Signed-off-by: Neeraj Upadhyay --- kernel/rcu/tasks.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h index 72dc0d0a4a8f..ef9de6b91a3d 100644 --- a/kernel/rcu/tasks.h +++ b/kernel/r

[PATCH v2 09/10] context_tracking: Invoke RCU-tasks enter/exit for NMI context

2024-10-09 Thread neeraj . upadhyay
From: Neeraj Upadhyay rcu_task_enter() and rcu_task_exit() are not called on NMI entry and exit. So, Tasks-RCU-Rude grace period wait is required to ensure that NMI handlers have entered/exited into Tasks-RCU eqs. For architectures which do not require Tasks-RCU-Rude (as the code sections where

[PATCH v2 08/10] rcu/tasks: Make RCU-tasks pay attention to idle tasks

2024-10-09 Thread neeraj . upadhyay
From: Neeraj Upadhyay Currently, idle tasks are ignored by RCU-tasks. Change this to start paying attention to idle tasks except in deep-idle functions where RCU is not watching. With this, for architectures where kernel entry/exit and deep-idle functions have been properly tagged noinstr, Tasks

[PATCH v2 07/10] rcu/tasks: Check RCU watching state for holdout idle injection tasks

2024-10-09 Thread neeraj . upadhyay
From: Neeraj Upadhyay Use RCU watching state of a CPU to check whether RCU-tasks GP need to wait for idle injection task on that CPU. Idle injection tasks which are in deep-idle states where RCU is not watching or which have transitioned to/from deep-idle state do not block RCU-tasks grace

[PATCH v2 06/10] rcu/tasks: Check RCU watching state for holdout idle tasks

2024-10-09 Thread neeraj . upadhyay
From: Neeraj Upadhyay Use RCU watching state of a CPU to check whether RCU-tasks GP need to wait for idle task on that CPU. Idle tasks which are in deep-idle states where RCU is not watching or which have transitioned to/from deep-idle state do not block RCU-tasks grace period. Signed-off-by

[PATCH v2 05/10] rcu/tasks: Consider idle tasks not running on CPU as non-holdouts

2024-10-09 Thread neeraj . upadhyay
From: Neeraj Upadhyay As idle tasks cannot be non-voluntary preempted, idle tasks which are not running on CPU are not in RCU-tasks read side critical section. So, remove them for holdout tasks for RCU-tasks. Signed-off-by: Neeraj Upadhyay --- kernel/rcu/tasks.h | 9 + 1 file changed

[PATCH v2 04/10] rcu/tasks: Create rcu_idle_task_is_holdout() definition for !SMP

2024-10-09 Thread neeraj . upadhyay
From: Neeraj Upadhyay rcu_idle_task_is_holdout() is called in rcu_tasks_kthread() context. As idle tasks cannot be non-voluntary preempted, non-running idle tasks are not in RCU-tasks critical section. So, idle task is not a RCU-tasks holdout task on !SMP (which also covers TINY_RCU). Signed

[PATCH v2 03/10] rcu/tasks: Move holdout checks for idle task to a separate function

2024-10-09 Thread neeraj . upadhyay
From: Neeraj Upadhyay Move checks for an idle task being a holdout task for RCU-tasks to a separate function - rcu_idle_task_is_holdout(). This function will be used in subsequent commits to add additional checks for idle task. No functional change intended. Suggested-by: Frederic Weisbecker

[PATCH v2 02/10] rcu: Make some rcu_watching_* functions global

2024-10-09 Thread neeraj . upadhyay
From: Neeraj Upadhyay rcu_watching_snap_in_eqs() and rcu_watching_snap_stopped_since() will be used in subsequent commits by RCU-tasks to check rcu_watching state of idle tasks. So, make these functions global. Signed-off-by: Neeraj Upadhyay --- kernel/rcu/rcu.h | 4 kernel/rcu/tree.c

[PATCH v2 01/10] rcu: Change rdp arg to cpu number for rcu_watching_snap_stopped_since()

2024-10-09 Thread neeraj . upadhyay
From: Neeraj Upadhyay In preparation of making rcu_watching_snap_stopped_since() available for RCU code outside of tree.c, change the rdp argument to cpu number. Signed-off-by: Neeraj Upadhyay --- kernel/rcu/tree.c | 14 +++--- kernel/rcu/tree_exp.h | 2 +- 2 files changed, 8

[PATCH v2 00/10] Make RCU Tasks scan idle tasks

2024-10-09 Thread neeraj . upadhyay
From: Neeraj Upadhyay Architectures for which all deep-idle and entry-exit functions are marked noinstr, synchronize_rcu_tasks_rude() is not required. However, disabling synchronize_rcu_tasks_rude() for such architectures require RCU-tasks to pay attention to idle tasks until they enter the

Re: [PATCH 3/3] rcu: Report callbacks enqueued on offline CPU blind spot

2024-10-08 Thread Neeraj Upadhyay
On 10/2/2024 8:30 PM, Frederic Weisbecker wrote: > Le Wed, Oct 02, 2024 at 04:57:38PM +0200, Frederic Weisbecker a écrit : >> Callbacks enqueued after rcutree_report_cpu_dead() fall into RCU barrier >> blind spot. Report any potential misuse. >> >> Reported-by: Paul E. McKenney >> Signed-off-by

Re: [RFC PATCH 0/4] Add hazard pointers to kernel

2024-09-19 Thread Neeraj Upadhyay
On 9/19/2024 12:16 PM, Linus Torvalds wrote: > On Thu, 19 Sept 2024 at 00:44, Neeraj Upadhyay > wrote: >> >> While we were working on this problem, this refcount scalability issue got >> resolved recently with conditional ref acquisition [3] (however, there are &

Re: [RFC PATCH 0/4] Add hazard pointers to kernel

2024-09-18 Thread Neeraj Upadhyay
On 9/18/2024 12:48 PM, Linus Torvalds wrote: > On Tue, 17 Sept 2024 at 16:34, Boqun Feng wrote: >> >> This series introduces hazard pointers [1] to kernel space. A TL;DR >> description of hazard pointers is "a scalable refcounting mechanim >> with RCU-like API". More information can be found at [2

[RFC 6/6] apparmor: Switch labels to percpu ref managed mode

2024-09-15 Thread Neeraj Upadhyay
Cache Domains apparmor=on (percpuref) scaling eff (%) 8C16T 1 100% 16C32T 2 96% 24C48T 3 94% 48C96T 6 93% 96C192T12 90% Signed-off-b

[RFC 5/6] apparmor: Switch labels to percpu refcount in atomic mode

2024-09-15 Thread Neeraj Upadhyay
. - Displacement of aa_label struct members to different cacheline, as percpu ref takes 2 pointers space. - Moving of the atomic counter outside of the cacheline of the aa_label struct. Signed-off-by: Neeraj Upadhyay --- security/apparmor/include/label.h | 16 security

[RFC 4/6] percpu-refcount-torture: Extend test with runtime mode switches

2024-09-15 Thread Neeraj Upadhyay
Extend the test to exercise runtime switching from managed mode to other reinitable active modes. Signed-off-by: Neeraj Upadhyay --- lib/percpu-refcount-torture.c | 41 +-- lib/percpu-refcount.c | 12 +- 2 files changed, 50 insertions(+), 3

[RFC 3/6] percpu-refcount: Extend managed mode to allow runtime switching

2024-09-15 Thread Neeraj Upadhyay
de using percpu_ref_switch_to_atomic(). Signed-off-by: Neeraj Upadhyay --- include/linux/percpu-refcount.h | 3 +- lib/percpu-refcount.c | 248 +++- 2 files changed, 88 insertions(+), 163 deletions(-) diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount

[RFC 2/6] percpu-refcount: Add torture test for percpu refcount

2024-09-15 Thread Neeraj Upadhyay
Add torture test to verify percpu managed mode operations, verifying that a percpu ref does not have non-zero count when all users have dropped their reference and that there is no early release of the ref while users hold references to it. Signed-off-by: Neeraj Upadhyay --- .../admin-guide

[RFC 1/6] percpu-refcount: Add managed mode for RCU released objects

2024-09-15 Thread Neeraj Upadhyay
ReInit D(RI/M) - Dead with ReInit and Managed PerCPU Ref Ops: KLL - Kill REI - Reinit RES - Resurrect Once a percpu ref is switched to managed mode, it cannot be switched to any other active mode. On reinit/resurrect, managed ref is reinitialized in managed mode. Signed-off-by: Neeraj Upadh

[RFC 0/6] Managed Percpu Refcount

2024-09-15 Thread Neeraj Upadhyay
ion. 4. Updates to torture test to test runtime mode switches from managed to unmanaged modes. 5. Switch Label refcount management to percpu ref in atomic mode. 6. Switch Label refcount management to managed mode. Highly appreciate any feedback/suggestions on the design approach. [1] https://lo

[GIT PULL] RCU changes for v6.12

2024-09-13 Thread Neeraj Upadhyay
_RCU_CORE rcu/nocb: Remove SEGCBLIST_KTHREAD_CB rcu/nocb: Simplify (de-)offloading state machine rcu/nocb: Fix RT throttling hrtimer armed from offline CPU rcu/nocb: Conditionally wake up rcuo if not already waiting on GP rcu/nocb: Remove superfluous memory bar

[tip: core/rcu] rcu: Fix CPU-offline trace in rcutree_dying_cpu

2021-04-11 Thread tip-bot2 for Neeraj Upadhyay
The following commit has been merged into the core/rcu branch of tip: Commit-ID: 47fcbc8dd62f15dc75916225ebacdc3bca9c12b2 Gitweb: https://git.kernel.org/tip/47fcbc8dd62f15dc75916225ebacdc3bca9c12b2 Author:Neeraj Upadhyay AuthorDate:Mon, 11 Jan 2021 17:15:58 +05:30

Re: [PATCH 01/13] rcu/nocb: Fix potential missed nocb_timer rearm

2021-03-03 Thread Neeraj Upadhyay
e entry. This commit fixes this bug by resetting rdp->nocb_defer_wakeup everytime we delete the ->nocb_timer. Fixes: d1b222c6be1f (rcu/nocb: Add bypass callback queueing) Cc: Stable Cc: Josh Triplett Cc: Lai Jiangshan Cc: Joel Fernandes

Re: [PATCH] arm64: Add part number for Arm Cortex-A78

2021-02-17 Thread Neeraj Upadhyay
On 2/17/2021 10:36 PM, Will Deacon wrote: On Wed, Feb 17, 2021 at 10:14:11PM +0530, Neeraj Upadhyay wrote: Add the MIDR part number info for the Arm Cortex-A78. Signed-off-by: Neeraj Upadhyay --- arch/arm64/include/asm/cputype.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch

[PATCH] arm64: Add part number for Arm Cortex-A78

2021-02-17 Thread Neeraj Upadhyay
Add the MIDR part number info for the Arm Cortex-A78. Signed-off-by: Neeraj Upadhyay --- arch/arm64/include/asm/cputype.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h index ef5b040..3aced88 100644 --- a/arch/arm64

[tip: core/rcu] rcu: Check and report missed fqs timer wakeup on RCU stall

2021-02-12 Thread tip-bot2 for Neeraj Upadhyay
The following commit has been merged into the core/rcu branch of tip: Commit-ID: 683954e55c981467bfd4688417e914bafc40959f Gitweb: https://git.kernel.org/tip/683954e55c981467bfd4688417e914bafc40959f Author:Neeraj Upadhyay AuthorDate:Mon, 16 Nov 2020 21:36:00 +05:30

Re: [PATCH] rcu: Correct cpu offline trace in rcutree_dying_cpu

2021-01-12 Thread Neeraj Upadhyay
On 1/12/2021 11:01 PM, Paul E. McKenney wrote: On Mon, Jan 11, 2021 at 05:15:58PM +0530, Neeraj Upadhyay wrote: Correctly trace whether the outgoing cpu blocks current gp in rcutree_dying_cpu(). Signed-off-by: Neeraj Upadhyay Good catch, queued, thank you! Please see below for my usual

[PATCH] rcu: Correct cpu offline trace in rcutree_dying_cpu

2021-01-11 Thread Neeraj Upadhyay
Correctly trace whether the outgoing cpu blocks current gp in rcutree_dying_cpu(). Signed-off-by: Neeraj Upadhyay --- kernel/rcu/tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 097990a..1f4bff4 100644 --- a/kernel/rcu/tree.c

[PATCH] rcu: Trace cbs accelerated without leaf rnp node lock held

2021-01-11 Thread Neeraj Upadhyay
Trace cbs which are accelerated without rnp lock help in rcu_accelerate_cbs_unlocked(). Signed-off-by: Neeraj Upadhyay --- kernel/rcu/tree.c | 21 ++--- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 338b817..097990a

[PATCH] rcu: Only trace when cbs are accelerated

2021-01-11 Thread Neeraj Upadhyay
Fix rcu_accelerate_cbs() traces to only trace when cbs are accelerated in current call. Signed-off-by: Neeraj Upadhyay --- kernel/rcu/tree.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 804e543..338b817 100644 --- a/kernel

[PATCH] rcu: Fix dynticks_nmi_nesting underflow check in rcu_is_cpu_rrupt_from_idle

2020-12-23 Thread Neeraj Upadhyay
for these smp_call_function() callbacks running from idle loop. However, this commit missed updating a preexisting underflow check of dynticks_nmi_nesting, which checks for a non zero positive value. Fix this warning and while at it, read the counter only once. Signed-off-by: Neeraj Upadhyay --- Hi, I wa

[tip: core/rcu] rcu: Clarify nocb kthreads naming in RCU_NOCB_CPU config

2020-12-13 Thread tip-bot2 for Neeraj Upadhyay
The following commit has been merged into the core/rcu branch of tip: Commit-ID: a3941517fcd6625adc540aef5ec3f717c8fa71e8 Gitweb: https://git.kernel.org/tip/a3941517fcd6625adc540aef5ec3f717c8fa71e8 Author:Neeraj Upadhyay AuthorDate:Thu, 24 Sep 2020 12:04:10 +05:30

[tip: core/rcu] rcu: Fix single-CPU check in rcu_blocking_is_gp()

2020-12-13 Thread tip-bot2 for Neeraj Upadhyay
The following commit has been merged into the core/rcu branch of tip: Commit-ID: ed73860cecc3ec12aa50a6dcfb4900e5b4ae9507 Gitweb: https://git.kernel.org/tip/ed73860cecc3ec12aa50a6dcfb4900e5b4ae9507 Author:Neeraj Upadhyay AuthorDate:Wed, 23 Sep 2020 12:59:33 +05:30

Re: [PATCH v2 tip/core/rcu 1/6] srcu: Make Tiny SRCU use multi-bit grace-period counter

2020-11-28 Thread Neeraj Upadhyay
On 11/28/2020 7:46 AM, Paul E. McKenney wrote: On Wed, Nov 25, 2020 at 10:03:26AM +0530, Neeraj Upadhyay wrote: On 11/24/2020 10:48 AM, Neeraj Upadhyay wrote: On 11/24/2020 1:25 AM, Paul E. McKenney wrote: On Mon, Nov 23, 2020 at 10:01:13AM +0530, Neeraj Upadhyay wrote: On 11/21/2020

Re: [PATCH v2 tip/core/rcu 6/6] srcu: Document polling interfaces for Tree SRCU grace periods

2020-11-27 Thread Neeraj Upadhyay
547.gf3365...@moria.home.lan/ Reported-by: Kent Overstreet Signed-off-by: Paul E. McKenney --- Reviewed-by: Neeraj Upadhyay Thanks Neeraj Documentation/RCU/Design/Requirements/Requirements.rst | 18 ++ 1 file changed, 18 insertions(+) diff --git a/Documentation/

Re: [PATCH v2 tip/core/rcu 5/6] srcu: Provide polling interfaces for Tree SRCU grace periods

2020-11-26 Thread Neeraj Upadhyay
Overstreet [ paulmck: Add EXPORT_SYMBOL_GPL() per kernel test robot feedback. ] [ paulmck: Apply feedback from Neeraj Upadhyay. ] Link: https://lore.kernel.org/lkml/20201117004017.GA7444@paulmck-ThinkPad-P72/ Signed-off-by: Paul E. McKenney --- For version in -rcu dev Reviewed-by: Neeraj Upadhyay

Re: [PATCH v2 tip/core/rcu 4/6] srcu: Provide polling interfaces for Tiny SRCU grace periods

2020-11-24 Thread Neeraj Upadhyay
On 11/25/2020 1:00 AM, Paul E. McKenney wrote: On Tue, Nov 24, 2020 at 10:44:24AM +0530, Neeraj Upadhyay wrote: On 11/24/2020 2:42 AM, Paul E. McKenney wrote: On Mon, Nov 23, 2020 at 10:13:13AM +0530, Neeraj Upadhyay wrote: On 11/21/2020 6:29 AM, paul...@kernel.org wrote: From: "

Re: [PATCH v2 tip/core/rcu 1/6] srcu: Make Tiny SRCU use multi-bit grace-period counter

2020-11-24 Thread Neeraj Upadhyay
On 11/24/2020 10:48 AM, Neeraj Upadhyay wrote: On 11/24/2020 1:25 AM, Paul E. McKenney wrote: On Mon, Nov 23, 2020 at 10:01:13AM +0530, Neeraj Upadhyay wrote: On 11/21/2020 6:29 AM, paul...@kernel.org wrote: From: "Paul E. McKenney" There is a need for a polling interfac

Re: AMU extension v1 support for cortex A76, A77, A78 CPUs

2020-11-23 Thread Neeraj Upadhyay
Thanks Marc, Vladimir, Mark, Sudeep for your inputs! Thanks Neeraj On 11/20/2020 3:43 PM, Mark Rutland wrote: On Fri, Nov 20, 2020 at 09:09:00AM +, Vladimir Murzin wrote: On 11/20/20 8:56 AM, Marc Zyngier wrote: On 2020-11-20 04:30, Neeraj Upadhyay wrote: Hi, For ARM cortex A76, A77

  1   2   >