linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: C vdso
Date: Wed, 25 Nov 2020 10:21:34 +0100	[thread overview]
Message-ID: <20201125102134.Horde.0HRWPh9SlZQBfjT7da-o2A1@messagerie.c-s.fr> (raw)
In-Reply-To: <87tuteyyxi.fsf@mpe.ellerman.id.au>


Quoting Michael Ellerman <mpe@ellerman.id.au>:

> Christophe Leroy <christophe.leroy@csgroup.eu> writes:
>> Le 03/11/2020 à 19:13, Christophe Leroy a écrit :
>>> Le 23/10/2020 à 15:24, Michael Ellerman a écrit :
>>>> Christophe Leroy <christophe.leroy@csgroup.eu> writes:
>>>>> Le 24/09/2020 à 15:17, Christophe Leroy a écrit :
>>>>>> Le 17/09/2020 à 14:33, Michael Ellerman a écrit :
>>>>>>> Christophe Leroy <christophe.leroy@csgroup.eu> writes:
>>>>>>>>
>>>>>>>> What is the status with the generic C vdso merge ?
>>>>>>>> In some mail, you mentionned having difficulties getting it working on
>>>>>>>> ppc64, any progress ? What's the problem ? Can I help ?
>>>>>>>
>>>>>>> Yeah sorry I was hoping to get time to work on it but haven't been able
>>>>>>> to.
>>>>>>>
>>>>>>> It's causing crashes on ppc64 ie. big endian.
>>>> ...
>>>>>>
>>>>>> Can you tell what defconfig you are using ? I have been able to  
>>>>>> setup a full glibc PPC64 cross
>>>>>> compilation chain and been able to test it under QEMU with  
>>>>>> success, using Nathan's vdsotest tool.
>>>>>
>>>>> What config are you using ?
>>>>
>>>> ppc64_defconfig + guest.config
>>>>
>>>> Or pseries_defconfig.
>>>>
>>>> I'm using Ubuntu GCC 9.3.0 mostly, but it happens with other  
>>>> toolchains too.
>>>>
>>>> At a minimum we're seeing relocations in the output, which is a problem:
>>>>
>>>>    $ readelf -r build\~/arch/powerpc/kernel/vdso64/vdso64.so
>>>>    Relocation section '.rela.dyn' at offset 0x12a8 contains 8 entries:
>>>>      Offset          Info           Type           Sym. Value     
>>>> Sym. Name + Addend
>>>>    000000001368  000000000016 R_PPC64_RELATIVE                     7c0
>>>>    000000001370  000000000016 R_PPC64_RELATIVE                     9300
>>>>    000000001380  000000000016 R_PPC64_RELATIVE                     970
>>>>    000000001388  000000000016 R_PPC64_RELATIVE                     9300
>>>>    000000001398  000000000016 R_PPC64_RELATIVE                     a90
>>>>    0000000013a0  000000000016 R_PPC64_RELATIVE                     9300
>>>>    0000000013b0  000000000016 R_PPC64_RELATIVE                     b20
>>>>    0000000013b8  000000000016 R_PPC64_RELATIVE                     9300
>>>
>>> Looks like it's due to the OPD and relation between the function()  
>>> and .function()
>>>
>>> By using DOTSYM() in the 'bl' call, that's directly the dot  
>>> function which is called and the OPD is
>>> not used anymore, it can get dropped.
>>>
>>> Now I get .rela.dyn full of 0, don't know if we should drop it explicitely.
>>
>> What is the status now with latest version of CVDSO ? I saw you had  
>> it in next-test for some time,
>> it is not there anymore today.
>
> Still having some trouble with the compat VDSO.
>
> eg:
>
> $ ./vdsotest clock-gettime-monotonic verify
> timestamp obtained from kernel predates timestamp
> previously obtained from libc/vDSO:
> 	[1346, 821441653] (vDSO)
> 	[570, 769440040] (kernel)
>
>
> And similar for all clocks except the coarse ones.
>

Ok, I managed to get the same with QEMU. Looking at the binary, I only  
see an mftb instead of the mftbu/mftb/mftbu triplet.

Fix below. Can you carry it, or do you prefer a full patch from me ?  
The easiest would be either to squash it into [v13,4/8]  
("powerpc/time: Move timebase functions into new asm/timebase.h"), or  
to add it between patch 4 and 5 ?

diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index f877a576b338..c3473eb031a3 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -1419,7 +1419,7 @@ static inline void msr_check_and_clear(unsigned  
long bits)
  		__msr_check_and_clear(bits);
  }

-#if defined(CONFIG_PPC_CELL) || defined(CONFIG_E500)
+#if defined(__powerpc64__) && (defined(CONFIG_PPC_CELL) ||  
defined(CONFIG_E500))
  #define mftb()		({unsigned long rval;				\
  			asm volatile(					\
  				"90:	mfspr %0, %2;\n"		\
diff --git a/arch/powerpc/include/asm/timebase.h  
b/arch/powerpc/include/asm/timebase.h
index a8eae3adaa91..7b372976f5a5 100644
--- a/arch/powerpc/include/asm/timebase.h
+++ b/arch/powerpc/include/asm/timebase.h
@@ -21,7 +21,7 @@ static inline u64 get_tb(void)
  {
  	unsigned int tbhi, tblo, tbhi2;

-	if (IS_ENABLED(CONFIG_PPC64))
+	if (IS_BUILTIN(__powerpc64__))
  		return mftb();

  	do {


  reply	other threads:[~2020-11-25  9:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200916165516.Horde.uocmo3irPb7BMg__NUSqRA9@messagerie.si.c-s.fr>
     [not found] ` <87r1r0oa4o.fsf@mpe.ellerman.id.au>
2020-09-24 13:17   ` C vdso Christophe Leroy
2020-10-23  6:28     ` Christophe Leroy
2020-10-23 13:24       ` Michael Ellerman
2020-10-24 10:07         ` Michael Ellerman
2020-10-24 11:16           ` Christophe Leroy
2020-11-03 18:11           ` Christophe Leroy
2020-11-03 18:13         ` Christophe Leroy
2020-11-24 10:11           ` Christophe Leroy
2020-11-25  2:04             ` Michael Ellerman
2020-11-25  9:21               ` Christophe Leroy [this message]
2020-11-25 12:22                 ` Michael Ellerman

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=20201125102134.Horde.0HRWPh9SlZQBfjT7da-o2A1@messagerie.c-s.fr \
    --to=christophe.leroy@csgroup.eu \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mpe@ellerman.id.au \
    /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 NNTP newsgroup(s).