From: yang li <yang.li85200@gmail.com>
To: Guo Ren <guoren@kernel.org>
Cc: linux-csky@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] csky: fix csky_cmpxchg_fixup not working
Date: Fri, 18 Oct 2024 16:46:42 +0800 [thread overview]
Message-ID: <CA+N+=zsB=wd2G-nsYT9xxvsgBMtnOMUJb8ru8XHaqusX2nzzEg@mail.gmail.com> (raw)
In-Reply-To: <CA+N+=zu0=scmv9w7iZE2ZebxBVpvVb1eeoJ-qi=vhac-JhLthg@mail.gmail.com>
Hi Guo Ren:
I used the readelf tool to view the address of csky_cmpxchg_ldw,
and used printk("0x%x\n",csky_cmpxchg_ldw) and
printk("0x%x\n",&csky_cmpxchg_ldw) to print it out in the code.
The result is that printk("0x%x\n",&csky_cmpxchg_ldw) prints the
correct result.
include/linux/linkage.h
#define GLOBAL(name) \
.globl name ASM_NL \
name:
#endif
arch/csky/kernel/atomic.S:
GLOBAL(csky_cmpxchg_ldw)
so
.globl csky_cmpxchg_ldw --->globl symbol
csky_cmpxchg_ldw: --->label symbol
yang li <yang.li85200@gmail.com> 于2024年10月18日周五 16:33写道:
>
> Hi Guo Ren:
> I used the readelf tool to view the address of csky_cmpxchg_ldw,
> and used printk("0x%x\n",csky_cmpxchg_ldw) and
> printk("0x%x\n",&csky_cmpxchg_ldw) to print it out in the code.
> The result is that printk("0x%x\n",&csky_cmpxchg_ldw) prints the
> correct result.
>
> include/linux/linkage.h
> #define GLOBAL(name) \
> .globl name ASM_NL \
> name:
> #endif
>
> arch/csky/kernel/atomic.S:
> GLOBAL(csky_cmpxchg_ldw)
> so
> .globl csky_cmpxchg_ldw --->globl symbol
> csky_cmpxchg_ldw: --->label symbol
>
>
>
>
> Guo Ren <guoren@kernel.org> 于2024年10月17日周四 14:05写道:
>>
>> On Wed, Oct 16, 2024 at 5:56 PM Yang Li <yang.li85200@gmail.com> wrote:
>> >
>> > In the csky_cmpxchg_fixup function, it is incorrect to use the global
>> > variable csky_cmpxchg_stw to determine the address where the exception
>> > occurred.The global variable csky_cmpxchg_stw stores the opcode at the
>> > time of the exception, while &csky_cmpxchg_stw shows the address where
>> > the exception occurred.
>> >
>> > Signed-off-by: Yang Li <yang.li85200@gmail.com>
>> > ---
>> > V1 -> V2:Eliminate compilation warnings
>> >
>> > arch/csky/mm/fault.c | 4 ++--
>> > 1 file changed, 2 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/arch/csky/mm/fault.c b/arch/csky/mm/fault.c
>> > index a885518ce1dd..5226bc08c336 100644
>> > --- a/arch/csky/mm/fault.c
>> > +++ b/arch/csky/mm/fault.c
>> > @@ -45,8 +45,8 @@ static inline void csky_cmpxchg_fixup(struct pt_regs *regs)
>> > if (trap_no(regs) != VEC_TLBMODIFIED)
>> > return;
>> >
>> > - if (instruction_pointer(regs) == csky_cmpxchg_stw)
>> > - instruction_pointer_set(regs, csky_cmpxchg_ldw);
>> > + if (instruction_pointer(regs) == (unsigned long)&csky_cmpxchg_stw)
>> > + instruction_pointer_set(regs, (unsigned long)&csky_cmpxchg_ldw);
>> csky_cmpxchg_ldw(stw) is a label symbol, not a variable.
>>
>> arch/csky/kernel/atomic.S:
>> GLOBAL(csky_cmpxchg_ldw)
>> GLOBAL(csky_cmpxchg_stw)
>>
>> Your modification does not affect the ASM output.
>>
>> (gdb) p main
>> $1 = {void (void)} 0x5fa <main>
>> (gdb) p &main
>> $2 = (void (*)(void)) 0x5fa <main>
>>
>> > return;
>> > }
>> > #endif
>> > --
>> > 2.34.1
>> >
>>
>>
>> --
>> Best Regards
>> Guo Ren
next prev parent reply other threads:[~2024-10-18 8:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-08 5:46 [PATCH] csky: fix csky_cmpxchg_fixup not working Yang Li
2024-10-16 2:10 ` kernel test robot
2024-10-16 9:56 ` [PATCH v2] " Yang Li
2024-10-17 6:04 ` Guo Ren
[not found] ` <CA+N+=zu0=scmv9w7iZE2ZebxBVpvVb1eeoJ-qi=vhac-JhLthg@mail.gmail.com>
2024-10-18 8:46 ` yang li [this message]
2024-10-21 7:51 ` yang li
2024-10-28 2:54 ` Guo Ren
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='CA+N+=zsB=wd2G-nsYT9xxvsgBMtnOMUJb8ru8XHaqusX2nzzEg@mail.gmail.com' \
--to=yang.li85200@gmail.com \
--cc=guoren@kernel.org \
--cc=linux-csky@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).