lkml.org 
[lkml]   [2020]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/6] arm64: scs: Store absolute SCS stack pointer value in thread_info
On Mon, May 18, 2020 at 12:37:10PM +0100, Mark Rutland wrote:
> On Fri, May 15, 2020 at 06:27:51PM +0100, Will Deacon wrote:
> > Storing the SCS information in thread_info as a {base,offset} pair
> > introduces an additional load instruction on the ret-to-user path,
> > since the SCS stack pointer in x18 has to be converted back to an offset
> > by subtracting the base.
> >
> > Replace the offset with the absolute SCS stack pointer value instead
> > and avoid the redundant load.
> >
> > Signed-off-by: Will Deacon <will@kernel.org>
>
> One trivial nit below, but regardless this looks sound to me, and I
> certainly prefer having the absolute address rather than an offset, so:
>
> Reviewed-by: Mark Rutland <mark.rutland@arm.com>
>
> > diff --git a/kernel/scs.c b/kernel/scs.c
> > index 9389c28f0853..5ff8663e4a67 100644
> > --- a/kernel/scs.c
> > +++ b/kernel/scs.c
> > @@ -60,8 +60,7 @@ int scs_prepare(struct task_struct *tsk, int node)
> > if (!s)
> > return -ENOMEM;
> >
> > - task_scs(tsk) = s;
> > - task_scs_offset(tsk) = 0;
> > + task_scs(tsk) = task_scs_sp(tsk) = s;
>
> I think this would be more legible as two statements:
>
> | task_sys(tsk) = s;
> | task_scs_sp(tsk) = s;

I think it's nice to be able to say:

task_scs(tsk) = task_scs_sp(tsk);

because it makes it very clear that they are initialised to the same thing.
Having it as two statements means somebody will update one and forget to
update the other one.

> ... as we usually save `foo = bar = baz` stuff for the start of a
> function or within loop conditions.

Hmm, I can't really find anything consistent in that regard, to be honest
with you. Did I miss something in the coding style doc?

I'll leave it as-is for now.

Will

\
 
 \ /
  Last update: 2020-05-18 15:39    [W:0.095 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site