tests: Use z_pend_curr() in sched benchmark

Replaces the use of z_pend_curr_irqlock() with z_pend_curr()
as the former is not used anywhere else anymore.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
This commit is contained in:
Peter Mitsis 2024-02-29 11:21:36 -05:00 committed by Anas Nashif
commit a55a078909

View file

@ -13,14 +13,14 @@
* of specific low level scheduling primitives independent of overhead * of specific low level scheduling primitives independent of overhead
* from application or API abstractions. It works very simply: a main * from application or API abstractions. It works very simply: a main
* thread creates a "partner" thread at a higher priority, the partner * thread creates a "partner" thread at a higher priority, the partner
* then sleeps using z_pend_curr_irqlock(). From this initial * then sleeps using z_pend_curr(). From this initial
* state: * state:
* *
* 1. The main thread calls z_unpend_first_thread() * 1. The main thread calls z_unpend_first_thread()
* 2. The main thread calls z_ready_thread() * 2. The main thread calls z_ready_thread()
* 3. The main thread calls k_yield() * 3. The main thread calls k_yield()
* (the kernel switches to the partner thread) * (the kernel switches to the partner thread)
* 4. The partner thread then runs and calls z_pend_curr_irqlock() again * 4. The partner thread then runs and calls z_pend_curr() again
* (the kernel switches to the main thread) * (the kernel switches to the main thread)
* 5. The main thread returns from k_yield() * 5. The main thread returns from k_yield()
* *
@ -49,6 +49,8 @@ enum {
uint32_t stamps[NUM_STAMP_STATES]; uint32_t stamps[NUM_STAMP_STATES];
static struct k_spinlock lock;
static inline int _stamp(int state) static inline int _stamp(int state)
{ {
uint32_t t; uint32_t t;
@ -79,9 +81,9 @@ static void partner_fn(void *arg1, void *arg2, void *arg3)
printk("Running %p\n", k_current_get()); printk("Running %p\n", k_current_get());
while (true) { while (true) {
unsigned int key = irq_lock(); k_spinlock_key_t key = k_spin_lock(&lock);
z_pend_curr_irqlock(key, &waitq, K_FOREVER); z_pend_curr(&lock, key, &waitq, K_FOREVER);
stamp(PARTNER_AWAKE_PENDING); stamp(PARTNER_AWAKE_PENDING);
} }
} }