Re: [PATCH v9 11/13] rust: hrtimer: add `HrTimerMode`
From: Andreas Hindborg
Date: Tue Feb 25 2025 - 04:09:21 EST
"Lyude Paul" <lyude@xxxxxxxxxx> writes:
> On Mon, 2025-02-24 at 13:03 +0100, Andreas Hindborg wrote:
>> +/// Operational mode of [`HrTimer`].
>> +#[derive(Clone, Copy)]
>
> PartialEq, Eq?
Sure, why not. I'm not sure if there is any negative side effects of
this? `Debug` too?
>
>> +pub enum HrTimerMode {
>> + /// Timer expires at the given expiration time.
>> + Absolute,
>> + /// Timer expires after the given expiration time interpreted as a duration from now.
>> + Relative,
>> + /// Timer does not move between CPU cores.
>> + Pinned,
>> + /// Timer handler is executed in soft irq context.
>> + Soft,
>> + /// Timer handler is executed in hard irq context.
>> + Hard,
>> + /// Timer expires at the given expiration time.
>> + /// Timer does not move between CPU cores.
>> + AbsolutePinned,
>> + /// Timer expires after the given expiration time interpreted as a duration from now.
>> + /// Timer does not move between CPU cores.
>> + RelativePinned,
>> + /// Timer expires at the given expiration time.
>> + /// Timer handler is executed in soft irq context.
>> + AbsoluteSoft,
>> + /// Timer expires after the given expiration time interpreted as a duration from now.
>> + /// Timer handler is executed in soft irq context.
>> + RelativeSoft,
>> + /// Timer expires at the given expiration time.
>> + /// Timer does not move between CPU cores.
>> + /// Timer handler is executed in soft irq context.
>> + AbsolutePinnedSoft,
>> + /// Timer expires after the given expiration time interpreted as a duration from now.
>> + /// Timer does not move between CPU cores.
>> + /// Timer handler is executed in soft irq context.
>> + RelativePinnedSoft,
>> + /// Timer expires at the given expiration time.
>> + /// Timer handler is executed in hard irq context.
>> + AbsoluteHard,
>> + /// Timer expires after the given expiration time interpreted as a duration from now.
>> + /// Timer handler is executed in hard irq context.
>> + RelativeHard,
>> + /// Timer expires at the given expiration time.
>> + /// Timer does not move between CPU cores.
>> + /// Timer handler is executed in hard irq context.
>> + AbsolutePinnedHard,
>> + /// Timer expires after the given expiration time interpreted as a duration from now.
>> + /// Timer does not move between CPU cores.
>> + /// Timer handler is executed in hard irq context.
>> + RelativePinnedHard,
>> +}
>
> Besides the question I had earlier about how we represent enums like this
> (e.g. using repr(u32) and using discriminants):
I'll await your response in the other thread
>
> Reviewed-by: Lyude Paul <lyude@xxxxxxxxxx>
>
Best regards,
Andreas Hindborg