Re: [RFC PATCH 2/2] RISC-V: Add support for sqoscfg CSR

From: Conor Dooley
Date: Fri Apr 21 2023 - 05:35:14 EST


On Mon, Apr 17, 2023 at 01:04:11PM -0700, Drew Fustini wrote:
> On Mon, Apr 17, 2023 at 08:10:20PM +0100, Conor Dooley wrote:
> > On Sun, Apr 09, 2023 at 09:36:46PM -0700, Drew Fustini wrote:

> > > #ifdef CONFIG_FPU
> > > extern void __fstate_save(struct task_struct *save_to);
> > > @@ -79,6 +80,7 @@ do { \
> > > if (has_fpu()) \
> > > __switch_to_aux(__prev, __next); \
> > > ((last) = __switch_to(__prev, __next)); \
> > > + qos_sched_in(__next); \
> >
> > Both FPU and vector do:
> > | if (has_fpu()) \
> > | __switch_to_fpu(__prev, __next); \
> > | if (has_vector()) \
> > | __switch_to_vector(__prev, __next); \
> >
> > Is it just my OCD that wants ssqosid to be the same?
>
> Thanks, I had not noticed those changes from the vector patch series [1]
> until you pointed it out. The handling of sqoscfg could be converted to
> that pattern too.
>
> > It'd also do away with that seems a bit weird to me: having
> > qos_sched_in() and __qos_sched_in().
> > Even if you don't make them similar, what's the rationale behind not
> > inverting the extension check & returning early from a single function.
>
> The goal was so the inline qos_sched_in() would turn into a nop when
> Ssqosid extensions not present. If Ssqosid was present, then the "real"
> function __qos_sched_in() would be called.
>
> However, having looked at the handling of fpu and vector in the vector
> series, I think will redo the sqoscfg handling to follow that pattern.

Aye. With the way they do it, if !CONFIG_..._SSQOSID, DCE should
remove the function call entirely & the has_extension_[un]likely() stuff
will give you your nop for kernels with CONFIG_..._SSQOSID but no
hardware support.

I think it looks "nicer"/more obvious if you copy what the fpu/vector
stuff does /shrug

Cheers,
Conor.

Attachment: signature.asc
Description: PGP signature