public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Deepak Gupta <debug@rivosinc.com>
To: Guo Ren <guoren@kernel.org>
Cc: palmer@dabbelt.com, linux-kernel@vger.kernel.org,
	linux-riscv@lists.infradead.org, paul.walmsley@sifive.com,
	Jisheng Zhang <jszhang@kernel.org>
Subject: Re: [PATCH] riscv: VMAP_STACK overflow detection thread-safe
Date: Thu, 24 Nov 2022 01:07:14 -0800	[thread overview]
Message-ID: <20221124090714.GB1896875@debug.ba.rivosinc.com> (raw)
In-Reply-To: <20221124082612.GC1149630@debug.ba.rivosinc.com>

On Thu, Nov 24, 2022 at 12:26:12AM -0800, Deepak Gupta wrote:
>On Thu, Nov 24, 2022 at 09:32:19AM +0800, Guo Ren wrote:
>>>+.macro asm_per_cpu dst sym tmp
>>>+       REG_L \tmp, TASK_TI_CPU_NUM(tp)
>>>+       slli \tmp, \tmp, 0x3
>>>+       la \dst, __per_cpu_offset
>>>+       add \dst, \dst, \tmp
>>>+       REG_L \tmp, 0(\dst)
>>>+       la \dst, \sym
>>>+       add \dst, \dst, \tmp
>>Another tricky asm code of using percpu, I don't know how the percpu
>>maintenance guy thinks.
>
>On this, if you can point me to someone, I would like to get their feedback.
>While discussing this, one issue that comes in my mind is if the shift 
>of 0x3 is correct or not on 32bit systems. I don't know what's the 
>size of each entry
>in `__per_cpu_offset`. On 64bit it's 8 bytes and thus 3 bit shift.

Yes this would need a fix for 32bit.
`__per_cpu_offset` is an array of `unsigned long` and thus shift should be 2 bit
on 32bit systems.


  reply	other threads:[~2022-11-24  9:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-24  0:50 [PATCH] riscv: VMAP_STACK overflow detection thread-safe Deepak Gupta
2022-11-24  1:32 ` Guo Ren
2022-11-24  8:26   ` Deepak Gupta
2022-11-24  9:07     ` Deepak Gupta [this message]
     [not found] ` <CAJF2gTQ=Vr6neABtz9JSCei6oPEsyWTpb-Y=Rxt5jy6n1VEtGA@mail.gmail.com>
2022-11-24  5:56   ` Deepak Gupta
2022-11-24  6:31     ` Guo Ren
2022-11-24  7:10       ` Deepak Gupta
2022-11-24  8:59         ` Conor Dooley
2022-11-24  9:10           ` Deepak Gupta
2022-11-24  9:36         ` Guo Ren
2022-11-24  6:30 ` Conor Dooley
2022-11-24  7:23   ` Deepak Gupta
2022-11-24  7:39     ` Conor Dooley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221124090714.GB1896875@debug.ba.rivosinc.com \
    --to=debug@rivosinc.com \
    --cc=guoren@kernel.org \
    --cc=jszhang@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox