mbox series

[RFC,v1,0/5] add new API for wait until scheme

Message ID 20210902053253.3017858-1-feifei.wang2@arm.com (mailing list archive)
Headers show
Series add new API for wait until scheme | expand

Message

Feifei Wang Sept. 2, 2021, 5:32 a.m. UTC
Add new API for wait_until scheme, and apply this new API into lib to
replace rte_pause.

Feifei Wang (5):
  eal: add new API for wait until scheme
  eal: use wait until scheme for read pflock
  eal: use wait until scheme for mcslock
  lib/bpf: use wait until scheme for Rx/Tx iteration
  lib/distributor: use wait until scheme

 lib/bpf/bpf_pkt.c                        |  11 +-
 lib/distributor/rte_distributor_single.c |  10 +-
 lib/eal/arm/include/rte_pause_64.h       | 271 ++++++++++++++++----
 lib/eal/include/generic/rte_mcslock.h    |   9 +-
 lib/eal/include/generic/rte_pause.h      | 309 +++++++++++++++++++++++
 lib/eal/include/generic/rte_pflock.h     |   5 +-
 6 files changed, 543 insertions(+), 72 deletions(-)

Comments

Stephen Hemminger Sept. 2, 2021, 3:22 p.m. UTC | #1
On Thu,  2 Sep 2021 13:32:48 +0800
Feifei Wang <feifei.wang2@arm.com> wrote:

> Add new API for wait_until scheme, and apply this new API into lib to
> replace rte_pause.
> 
> Feifei Wang (5):
>   eal: add new API for wait until scheme
>   eal: use wait until scheme for read pflock
>   eal: use wait until scheme for mcslock
>   lib/bpf: use wait until scheme for Rx/Tx iteration
>   lib/distributor: use wait until scheme
> 
>  lib/bpf/bpf_pkt.c                        |  11 +-
>  lib/distributor/rte_distributor_single.c |  10 +-
>  lib/eal/arm/include/rte_pause_64.h       | 271 ++++++++++++++++----
>  lib/eal/include/generic/rte_mcslock.h    |   9 +-
>  lib/eal/include/generic/rte_pause.h      | 309 +++++++++++++++++++++++
>  lib/eal/include/generic/rte_pflock.h     |   5 +-
>  6 files changed, 543 insertions(+), 72 deletions(-)
> 

Since these are all inline, would it be possible to make
this a macro and have the caller pass a condition function?

Look at Linux wait_event() for an example of that.
Feifei Wang Sept. 3, 2021, 7:02 a.m. UTC | #2
Hi, Stephen

Thanks for the reviewing. I think it is a good comment.
According to the comments, we plan to change this API as follow:

#define wait_until_event_16(addr, mask, expected, op, memorder)
	uint16_t value
	__LOAD_EXC_16(addr, value, memorder)
	if ((value&mask) op expected) {
		__SEVL()
		do {
			__WFE()
			__LOAD_EXC_16(addr, value, memorder)
		} while ((value&mask) op expected);

1. According to the size, there will be three definitions: 16/32/64 bits
2. op is defined for a symbol(!= or ==), I'm not sure whether it is legal in dpdk.
3. If the case is not 'wait_part_equal/unequal', mask can be 0xFF. 

Have you any more comments for this change?

Best Regards
Feifei
> -----邮件原件-----
> 发件人: Stephen Hemminger <stephen@networkplumber.org>
> 发送时间: Thursday, September 2, 2021 11:22 PM
> 收件人: Feifei Wang <Feifei.Wang2@arm.com>
> 抄送: dev@dpdk.org; nd <nd@arm.com>
> 主题: Re: [dpdk-dev] [RFC PATCH v1 0/5] add new API for wait until scheme
> 
> On Thu,  2 Sep 2021 13:32:48 +0800
> Feifei Wang <feifei.wang2@arm.com> wrote:
> 
> > Add new API for wait_until scheme, and apply this new API into lib to
> > replace rte_pause.
> >
> > Feifei Wang (5):
> >   eal: add new API for wait until scheme
> >   eal: use wait until scheme for read pflock
> >   eal: use wait until scheme for mcslock
> >   lib/bpf: use wait until scheme for Rx/Tx iteration
> >   lib/distributor: use wait until scheme
> >
> >  lib/bpf/bpf_pkt.c                        |  11 +-
> >  lib/distributor/rte_distributor_single.c |  10 +-
> >  lib/eal/arm/include/rte_pause_64.h       | 271 ++++++++++++++++----
> >  lib/eal/include/generic/rte_mcslock.h    |   9 +-
> >  lib/eal/include/generic/rte_pause.h      | 309 +++++++++++++++++++++++
> >  lib/eal/include/generic/rte_pflock.h     |   5 +-
> >  6 files changed, 543 insertions(+), 72 deletions(-)
> >
> 
> Since these are all inline, would it be possible to make this a macro and have
> the caller pass a condition function?
> 
> Look at Linux wait_event() for an example of that.