Re: [PATCH v6 14/24] x86/resctrl: Allow resctrl_arch_rmid_read() to sleep

Reinette Chatre
2023-10-03T21:18:57Z

Hi James,

On 9/14/2023 10:21 AM, James Morse wrote:

..

> @@ -245,6 +250,17 @@ int resctrl_arch_rmid_read(struct rdt_resource *r, struct rdt_domain *d,
> u32 closid, u32 rmid, enum resctrl_event_id eventid,
> u64 *val);
>
> +/**
> + * resctrl_arch_rmid_read_context_check() - warn about invalid contexts
> + *
> + * When built with CONFIG_DEBUG_ATOMIC_SLEEP generate a warning when
> + * resctrl_arch_rmid_read() is called with preemption disabled.
> + */
> +static inline void resctrl_arch_rmid_read_context_check(void)
> +{
> + if (!irqs_disabled())
> + might_sleep();
> +}
>
> /**
> * resctrl_arch_reset_rmid() - Reset any private state associated with rmid

I was expecting the above to look like you said it would look [1].

Reinette

[1] https://lore.kernel.org/lkml/9d69d0ca-212d-9b1b-3001-9f56731e48fd@arm.com/