New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Driver-specific spinlock for cxd56_serial.c #2830
Conversation
Summary: - This commit introduces spinlock_t for #ifndef CONFIG_SPINLOCK which is useful for the non-SMP case because it does not consume memory Impact: - None: Testing: - N/A Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
Summary: - This commit introduces driver-specific spinlock in cxd56_serial.c to improve performance Impact: - SMP only Testing: - Tested with spresense:wifi and spresense:wifi_smp Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
73964be
to
7a4f19a
Compare
@@ -30,7 +30,11 @@ | |||
#include <sys/types.h> | |||
#include <stdint.h> | |||
|
|||
#ifdef CONFIG_SPINLOCK | |||
#ifndef CONFIG_SPINLOCK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to understand the outcome of this change when CONFIG_SPINLOCK
is not defined.
From what I understood, &priv->lock
should always evaluate to NULL
when CONFIG_SPINLOCK
is not defined.
I've tried to isolate this behavior in an example, but I couldn't achieve the same result. Instead, the pointer to the empty struct is never NULL
.
Did I do something wrong in my test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @gustavonihei,
Actually, when CONFIG_SPINLOCK is not defined CONFIG_SMP is not defined either.
So, finally, spin_lock_irqsave(l) will be just up_irq_save().
include/nuttx/irq.h
...
#if defined(CONFIG_SMP)
irqstate_t spin_lock_irqsave(spinlock_t *lock);
#else
# define spin_lock_irqsave(l) up_irq_save()
#endif
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification, @masayuki2009!
Summary
which is useful for the non-SMP case because it does not consume
memory
to improve performance
Impact
Testing