From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751446AbcEIKLM (ORCPT ); Mon, 9 May 2016 06:11:12 -0400 Received: from szxga04-in.huawei.com ([58.251.152.52]:16442 "EHLO szxga04-in.huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751188AbcEIKLJ (ORCPT ); Mon, 9 May 2016 06:11:09 -0400 Subject: Re: [PATCH 24/25] arm64:ilp32: add vdso-ilp32 and use for signal return To: Yury Norov , Andrew Pinski References: <1459894127-17698-1-git-send-email-ynorov@caviumnetworks.com> <1554541.oDP7Ro5zB2@wuerfel> <20160503090045.GB10733@e104818-lin.cambridge.arm.com> <3846428.6xx69KGEja@wuerfel> <57288660.9030607@huawei.com> <57289C75.50904@huawei.com> <20160504214949.GA28217@yury-N73SV> <572AAED2.7050604@huawei.com> <20160506140022.GA18587@yury-N73SV> CC: Arnd Bergmann , Catalin Marinas , Linux-Arch , linux-s390 , "Kapoor, Prasun" , Andreas Schwab , "Mark Brown" , , Heiko Carstens , LKML , "Alexander Graf" , Alexey Klimov , "Joseph S. Myers" , Martin Schwidefsky , Nathan Lynch , "Philipp Tomsich" , "linux-arm-kernel@lists.infradead.org" , , Hanjun Guo , "Zhangjian (Bamvor)" From: "Zhangjian (Bamvor)" Message-ID: <5730614A.2000601@huawei.com> Date: Mon, 9 May 2016 18:07:06 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <20160506140022.GA18587@yury-N73SV> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.72.170] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.57306161.0158,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: f402f2582e888a0577fdbd6fc111d671 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, yury I tested successful in both little endian and big endian. Just two comments below: On 2016/5/6 22:00, Yury Norov wrote: > Hello colleagues, > > After all comments, VDSO fix looks like this for me. > > Note I renamed Andrew's ZERO macro to DELOUSE, as > there already is __SC_DELOUSE which does the same, > but in C, not asm. > > Like Bamvor, I'm not sure how we'd apply this patch - > standalone or meld to VDSO. I think, VDSO patch is too > big and bad-structurized, and if I find how to refactor > it, I'll incorporate this fix. > > Signed-off-by: Yury Norov > --- > arch/arm64/kernel/asm-offsets.c | 7 +++++++ > arch/arm64/kernel/vdso-ilp32/vdso-ilp32.lds.S | 2 +- > arch/arm64/kernel/vdso/gettimeofday.S | 20 +++++++++++++++++--- > 3 files changed, 25 insertions(+), 4 deletions(-) > > diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c > index e229525..fcfd087 100644 > --- a/arch/arm64/kernel/asm-offsets.c > +++ b/arch/arm64/kernel/asm-offsets.c > @@ -101,6 +101,13 @@ int main(void) > DEFINE(TSPEC_TV_SEC, offsetof(struct timespec, tv_sec)); > DEFINE(TSPEC_TV_NSEC, offsetof(struct timespec, tv_nsec)); > BLANK(); > +#ifdef CONFIG_ARM64_ILP32 The following structs exist in both aarch32 el0 and ilp32. How about change it to "#ifdef CONFIG_COMPAT"? > + DEFINE(COMPAT_TVAL_TV_SEC, offsetof(struct compat_timeval, tv_sec)); > + DEFINE(COMPAT_TVAL_TV_USEC, offsetof(struct compat_timeval, tv_usec)); > + DEFINE(COMPAT_TSPEC_TV_SEC, offsetof(struct compat_timespec, tv_sec)); > + DEFINE(COMPAT_TSPEC_TV_NSEC, offsetof(struct compat_timespec, tv_nsec)); > + BLANK(); > +#endif > DEFINE(TZ_MINWEST, offsetof(struct timezone, tz_minuteswest)); > DEFINE(TZ_DSTTIME, offsetof(struct timezone, tz_dsttime)); > BLANK(); > diff --git a/arch/arm64/kernel/vdso-ilp32/vdso-ilp32.lds.S b/arch/arm64/kernel/vdso-ilp32/vdso-ilp32.lds.S > index ddc63fd..d182a8d 100644 > --- a/arch/arm64/kernel/vdso-ilp32/vdso-ilp32.lds.S > +++ b/arch/arm64/kernel/vdso-ilp32/vdso-ilp32.lds.S > @@ -79,7 +79,7 @@ PHDRS > */ > VERSION > { > - LINUX_2.6 { > + LINUX_2.6.39 { Do we really want to this version? Maybe 4.x is better? Regards Bamvor > global: > __kernel_rt_sigreturn; > __kernel_gettimeofday; > diff --git a/arch/arm64/kernel/vdso/gettimeofday.S b/arch/arm64/kernel/vdso/gettimeofday.S > index efa79e8..a2d8a70 100644 > --- a/arch/arm64/kernel/vdso/gettimeofday.S > +++ b/arch/arm64/kernel/vdso/gettimeofday.S > @@ -25,6 +25,16 @@ > #define NSEC_PER_SEC_LO16 0xca00 > #define NSEC_PER_SEC_HI16 0x3b9a > > +#ifdef __LP64__ > +#define PTR_REG(n) x##n > +#define OFFSET(n) n > +#define DELOUSE(n) > +#else > +#define PTR_REG(n) w##n > +#define OFFSET(n) COMPAT_##n > +#define DELOUSE(n) mov w##n, w##n > +#endif > + > vdso_data .req x6 > use_syscall .req w7 > seqcnt .req w8 > @@ -51,6 +61,8 @@ seqcnt .req w8 > /* int __kernel_gettimeofday(struct timeval *tv, struct timezone *tz); */ > ENTRY(__kernel_gettimeofday) > .cfi_startproc > + DELOUSE(0) > + DELOUSE(1) > mov x2, x30 > .cfi_register x30, x2 > > @@ -68,7 +80,7 @@ ENTRY(__kernel_gettimeofday) > mov x13, #1000 > lsl x13, x13, x12 > udiv x11, x11, x13 > - stp x10, x11, [x0, #TVAL_TV_SEC] > + stp PTR_REG(10), PTR_REG(11), [x0, #OFFSET(TVAL_TV_SEC)] > 2: > /* If tz is NULL, return 0. */ > cbz x1, 3f > @@ -88,6 +100,7 @@ ENDPROC(__kernel_gettimeofday) > /* int __kernel_clock_gettime(clockid_t clock_id, struct timespec *tp); */ > ENTRY(__kernel_clock_gettime) > .cfi_startproc > + DELOUSE(1) > cmp w0, #CLOCK_REALTIME > ccmp w0, #CLOCK_MONOTONIC, #0x4, ne > b.ne 2f > @@ -159,7 +172,7 @@ ENTRY(__kernel_clock_gettime) > > 6: /* Store to the user timespec. */ > lsr x11, x11, x12 > - stp x10, x11, [x1, #TSPEC_TV_SEC] > + stp PTR_REG(10), PTR_REG(11), [x1, #OFFSET(TSPEC_TV_SEC)] > mov x0, xzr > ret > 7: > @@ -174,6 +187,7 @@ ENDPROC(__kernel_clock_gettime) > /* int __kernel_clock_getres(clockid_t clock_id, struct timespec *res); */ > ENTRY(__kernel_clock_getres) > .cfi_startproc > + DELOUSE(1) > cmp w0, #CLOCK_REALTIME > ccmp w0, #CLOCK_MONOTONIC, #0x4, ne > b.ne 1f > @@ -187,7 +201,7 @@ ENTRY(__kernel_clock_getres) > ldr x2, 6f > 2: > cbz w1, 3f > - stp xzr, x2, [x1] > + stp PTR_REG(zr), PTR_REG(2), [x1] > > 3: /* res == NULL. */ > mov w0, wzr >