mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: zhangqing <zhangqing@loongson.cn>
To: Huacai Chen <chenhuacai@kernel.org>
Cc: WANG Xuerui <kernel@xen0n.name>,
	loongarch@lists.linux.dev, LKML <linux-kernel@vger.kernel.org>,
	Jiaxun Yang <jiaxun.yang@flygoat.com>,
	Jinyang He <hejinyang@loongson.cn>
Subject: Re: [PATCH 3/4] LoongArch: Add stacktrace support
Date: Tue, 2 Aug 2022 09:19:54 +0800	[thread overview]
Message-ID: <3cc6aebc-87e7-f0d0-2a88-e7e742e1e5ee@loongson.cn> (raw)
In-Reply-To: <CAAhV-H6Az_X1afvAO+JxnDaW-Ey_8wmozehd++qOZoGmimM+6g@mail.gmail.com>



On 2022/8/1 下午11:30, Huacai Chen wrote:
> Hi, Qing,
> 
> On Mon, Aug 1, 2022 at 8:17 PM Qing Zhang <zhangqing@loongson.cn> wrote:
>>
>> Use common arch_stack_walk infrastructure to avoid duplicated code and
>> avoid taking care of the stack storage and filtering.
>> Add sra (means __schedule return address) and scfa (means __schedule call
>> frame address) to thread_info and store it in switch_to().
>>
>> Now we can print the process stack by cat /proc/*/stack and can better
>> support ftrace.
>>
>> Signed-off-by: Qing Zhang <zhangqing@loongson.cn>
>> ---
>>   arch/loongarch/Kconfig                 |  5 ++++
>>   arch/loongarch/include/asm/processor.h |  9 +++++++
>>   arch/loongarch/include/asm/switch_to.h | 14 ++++++----
>>   arch/loongarch/include/asm/uaccess.h   |  4 +--
>>   arch/loongarch/kernel/Makefile         |  1 +
>>   arch/loongarch/kernel/asm-offsets.c    |  2 ++
>>   arch/loongarch/kernel/process.c        |  3 +++
>>   arch/loongarch/kernel/stacktrace.c     | 37 ++++++++++++++++++++++++++
>>   arch/loongarch/kernel/switch.S         |  2 ++
>>   9 files changed, 70 insertions(+), 7 deletions(-)
>>   create mode 100644 arch/loongarch/kernel/stacktrace.c
>>
>> diff --git a/arch/loongarch/include/asm/uaccess.h b/arch/loongarch/include/asm/uaccess.h
>> index 2b44edc604a2..a8ae2af4025a 100644
>> --- a/arch/loongarch/include/asm/uaccess.h
>> +++ b/arch/loongarch/include/asm/uaccess.h
>> @@ -229,13 +229,13 @@ extern unsigned long __copy_user(void *to, const void *from, __kernel_size_t n);
>>   static inline unsigned long __must_check
>>   raw_copy_from_user(void *to, const void __user *from, unsigned long n)
>>   {
>> -       return __copy_user(to, from, n);
>> +       return __copy_user(to, (__force const void *)from, n);
>>   }
>>
>>   static inline unsigned long __must_check
>>   raw_copy_to_user(void __user *to, const void *from, unsigned long n)
>>   {
>> -       return __copy_user(to, from, n);
>> +       return __copy_user((__force void *)to, from, n);
> Why this? Does it have something to do with stacktrace?
> 
> Huacai

Hi, huacai

This is kernel test robot report sparse warnings:
I reproduced locally and found that other architectures calling 
__copy_user also use __force conversion, Is this modification appropriate?

kernel/trace/trace_events_user.c: note: in included file (through 
include/linux/uaccess.h, include/linux/sched/task.h, 
include/linux/sched/signal.h, ...):
    arch/loongarch/include/asm/uaccess.h:232:32: sparse: sparse: 
incorrect type in argument 2 (different address spaces) @@     expected 
void const *from @@     got void const [noderef] __user *from @@
    arch/loongarch/include/asm/uaccess.h:232:32: sparse:     expected 
void const *from
    arch/loongarch/include/asm/uaccess.h:232:32: sparse:     got void 
const [noderef] __user *from

Thanks,
-Qing



  reply	other threads:[~2022-08-02  1:20 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-01 12:17 [PATCH 0/4] LoongArch: Add unwinder support Qing Zhang
2022-08-01 12:17 ` [PATCH 1/4] LoongArch: Add guess " Qing Zhang
2022-08-01 15:28   ` Huacai Chen
2022-08-01 12:17 ` [PATCH 2/4] LoongArch: Add prologue " Qing Zhang
2022-08-01 15:26   ` Huacai Chen
2022-08-02  1:30     ` Youling Tang
2022-08-02  1:34       ` Huacai Chen
2022-08-02  1:39         ` Xi Ruoyao
2022-08-02  1:53           ` Huacai Chen
2022-08-01 12:17 ` [PATCH 3/4] LoongArch: Add stacktrace support Qing Zhang
2022-08-01 15:30   ` Huacai Chen
2022-08-02  1:19     ` zhangqing [this message]
2022-08-02  1:30       ` Huacai Chen
2022-08-02  2:01         ` Qing Zhang
2022-08-13 22:29   ` kernel test robot
2022-08-14  5:31   ` kernel test robot
2022-08-01 12:17 ` [PATCH 4/4] LoongArch: Add USER_STACKTRACE support Qing Zhang
2022-08-01 15:31   ` Huacai Chen
2022-08-01 15:34 ` [PATCH 0/4] LoongArch: Add unwinder support Huacai Chen
2022-08-02  1:15   ` Xi Ruoyao
2022-08-02  1:35   ` zhangqing

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=3cc6aebc-87e7-f0d0-2a88-e7e742e1e5ee@loongson.cn \
    --to=zhangqing@loongson.cn \
    --cc=chenhuacai@kernel.org \
    --cc=hejinyang@loongson.cn \
    --cc=jiaxun.yang@flygoat.com \
    --cc=kernel@xen0n.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    /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

all inboxes | Powered by JetHome®