DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: Thinh Tran <thinhtr@linux.vnet.ibm.com>
Cc: dev <dev@dpdk.org>, David Christensen <drc@linux.vnet.ibm.com>
Subject: Re: [dpdk-dev] [PATCH v2] eal/ppc64: improve rte_rdtsc with ppc_get_timebase
Date: Wed, 5 Feb 2020 22:29:22 +0100	[thread overview]
Message-ID: <CAJFAV8yrgRJzkD9PSU=aZpuvPH52jWYnf=AZRsDAN6GHbfSvhQ@mail.gmail.com> (raw)
In-Reply-To: <20200131220336.103874-1-thinhtr@linux.vnet.ibm.com>

On Fri, Jan 31, 2020 at 11:04 PM Thinh Tran <thinhtr@linux.vnet.ibm.com> wrote:
>
>   __ppc_get_timebase() is GNU extension and is more efficient

The commit title and log are quite short and give little idea on what
this is about.


I had a look at this glibc helper:

/* Read the Time Base Register.   */
static __inline__ uint64_t
__ppc_get_timebase (void)
{
#if __GNUC_PREREQ (4, 8)
  return __builtin_ppc_get_timebase ();
#else
# ifdef __powerpc64__
  uint64_t __tb;
  /* "volatile" is necessary here, because the user expects this assembly
     isn't moved after an optimization.  */
  __asm__ volatile ("mfspr %0, 268" : "=r" (__tb));
  return __tb;
# else  /* not __powerpc64__ */
  uint32_t __tbu, __tbl, __tmp; \
  __asm__ volatile ("0:\n\t"
                    "mftbu %0\n\t"
                    "mftbl %1\n\t"
                    "mftbu %2\n\t"
                    "cmpw %0, %2\n\t"
                    "bne- 0b"
                    : "=r" (__tbu), "=r" (__tbl), "=r" (__tmp));
  return (((uint64_t) __tbu << 32) | __tbl);
# endif  /* not __powerpc64__ */
#endif
}

The last block is exactly the code we had in dpdk.
So I suppose we are trying to use mfspr for register 268 which seems
linked to timebase (looking at the linux kernel sources).

Please, confirm this is an enhancement (and how this improves current
ppc support).
Thanks.


-- 
David Marchand


  parent reply	other threads:[~2020-02-05 21:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-28 21:02 [dpdk-dev] [PATCH] " Thinh Tran
2020-01-31  0:15 ` David Christensen
2020-01-31 14:54 ` Thinh Tran
2020-01-31 22:03 ` [dpdk-dev] [PATCH v2] " Thinh Tran
2020-02-04 18:00   ` David Christensen
2020-02-05 21:29   ` David Marchand [this message]
2020-02-10 17:53     ` Thinh Tran
2020-03-10 12:55   ` David Marchand
2020-03-11 20:26     ` Thinh Tran

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='CAJFAV8yrgRJzkD9PSU=aZpuvPH52jWYnf=AZRsDAN6GHbfSvhQ@mail.gmail.com' \
    --to=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=drc@linux.vnet.ibm.com \
    --cc=thinhtr@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).