DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: "Morten Brørup" <mb@smartsharesystems.com>
Cc: Shijith Thotton <sthotton@marvell.com>, <dev@dpdk.org>,
	<pbhagavatula@marvell.com>, <Honnappa.Nagarahalli@arm.com>,
	<jerinj@marvell.com>, <olivier.matz@6wind.com>,
	<stephen@networkplumber.org>,  <thomas@monjalon.net>,
	Nicolas Chautru <nicolas.chautru@intel.com>,
	"Ciara Power" <ciara.power@intel.com>,
	Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>,
	Chengwen Feng <fengchengwen@huawei.com>,
	Kevin Laatz <kevin.laatz@intel.com>,
	Reshma Pattan <reshma.pattan@intel.com>,
	 Maxime Coquelin <maxime.coquelin@redhat.com>,
	Chenbo Xia <chenbo.xia@intel.com>
Subject: Re: [PATCH v1 1/4] build: add meson option to configure IOVA mode as VA
Date: Tue, 30 Aug 2022 09:32:28 +0100	[thread overview]
Message-ID: <Yw3LHFj2EcsQ7tTf@bricha3-MOBL.ger.corp.intel.com> (raw)
In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35D872D0@smartserver.smartshare.dk>

On Mon, Aug 29, 2022 at 08:18:56PM +0200, Morten Brørup wrote:
> > From: Shijith Thotton [mailto:sthotton@marvell.com]
> > Sent: Monday, 29 August 2022 17.16
> > 
> > IOVA mode in DPDK is either PA or VA. The new build option iova_as_va
> > configures the mode to VA at compile time and prevents setting it to PA
> > at runtime. For now, all drivers which are not always enabled are
> > disabled with this option. Supported driver can set the flag
> > pmd_iova_as_va in its build file to enable build.
> > 
> > mbuf structure holds the physical (PA) and virtual address (VA) of a
> > buffer. if IOVA mode is set to VA, PA is redundant as it is the same as
> > VA. So PA field need not be updated and marked invalid if the build is
> > configured to use only VA.
> > 
> > Signed-off-by: Shijith Thotton <sthotton@marvell.com>
> > ---
> 
> [...]
> 
> > diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c
> > index e09b2549ca..992b8c64ab 100644
> > --- a/app/test/test_mbuf.c
> > +++ b/app/test/test_mbuf.c
> > @@ -1232,11 +1232,13 @@ test_failing_mbuf_sanity_check(struct
> > rte_mempool *pktmbuf_pool)
> >  		return -1;
> >  	}
> > 
> > -	badbuf = *buf;
> > -	badbuf.buf_iova = 0;
> > -	if (verify_mbuf_check_panics(&badbuf)) {
> > -		printf("Error with bad-physaddr mbuf test\n");
> > -		return -1;
> > +	if (!rte_is_iova_as_va_build()) {
> > +		badbuf = *buf;
> > +		rte_mbuf_iova_set(&badbuf, 0);
> > +		if (verify_mbuf_check_panics(&badbuf)) {
> > +			printf("Error with bad-physaddr mbuf test\n");
> > +			return -1;
> > +		}
> >  	}
> > 
> >  	badbuf = *buf;
> > diff --git a/config/meson.build b/config/meson.build
> > index 7f7b6c92fd..1ff1cd774b 100644
> > --- a/config/meson.build
> > +++ b/config/meson.build
> > @@ -309,6 +309,9 @@ endif
> >  if get_option('mbuf_refcnt_atomic')
> >      dpdk_conf.set('RTE_MBUF_REFCNT_ATOMIC', true)
> >  endif
> > +if get_option('iova_as_va')
> > +    dpdk_conf.set('RTE_IOVA_AS_VA', true)
> > +endif
> > 
> >  compile_time_cpuflags = []
> >  subdir(arch_subdir)
> > diff --git a/drivers/meson.build b/drivers/meson.build
> > index b22c2adda7..469e60f1fa 100644
> > --- a/drivers/meson.build
> > +++ b/drivers/meson.build
> > @@ -103,6 +103,7 @@ foreach subpath:subdirs
> >          ext_deps = []
> >          pkgconfig_extra_libs = []
> >          testpmd_sources = []
> > +        pmd_iova_as_va = false
> > 
> >          if not enable_drivers.contains(drv_path)
> >              build = false
> > @@ -120,6 +121,11 @@ foreach subpath:subdirs
> >              # pull in driver directory which should update all the
> > local variables
> >              subdir(drv_path)
> > 
> > +            if dpdk_conf.has('RTE_IOVA_AS_VA') and not pmd_iova_as_va
> > and not always_enable.contains(drv_path)
> > +                build = false
> > +                reason = 'driver does not support IOVA as VA mode'
> > +            endif
> > +
> >              # get dependency objs from strings
> >              shared_deps = ext_deps
> >              static_deps = ext_deps
> > diff --git a/lib/eal/include/rte_common.h
> > b/lib/eal/include/rte_common.h
> > index a96cc2a138..0010ad7c7d 100644
> > --- a/lib/eal/include/rte_common.h
> > +++ b/lib/eal/include/rte_common.h
> > @@ -921,6 +921,23 @@ __rte_noreturn void
> >  rte_exit(int exit_code, const char *format, ...)
> >  	__rte_format_printf(2, 3);
> > 
> > +/**
> > + * Check if build is configured to use IOVA as VA.
> > + *
> > + * @return
> > + *   1 if true, 0 otherwise
> > + *
> > + */
> > +static inline int
> > +rte_is_iova_as_va_build(void)
> > +{
> > +#ifdef RTE_IOVA_AS_VA
> > +	return 1;
> > +#else
> > +	return 0;
> > +#endif
> > +}
> 
> The rte_is_iova_as_va_build() function is effectively a shadow of the RTE_IOVA_AS_VA definition. Why the need to camouflage RTE_IOVA_AS_VA through a function, instead of just using RTE_IOVA_AS_VA everywhere?
> 
My reading is that it's not quite equivalent, and in the undef case it
can't be directly used in C code. You can't do "if (RTE_IOVA_AS_VA)", for
example. However, rather than adding a function, in meson you could also
add "dpdk_conf.set10(RTE_IOVA....)" to define a second macro that is 0 in
the undef case, and which therefore could be used in C conditionals.

/Bruce

  reply	other threads:[~2022-08-30  8:32 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-30 16:25 [PATCH] mbuf: add mbuf physical address field to dynamic field Shijith Thotton
2022-06-30 16:45 ` Stephen Hemminger
2022-07-01 12:16   ` Shijith Thotton
2022-07-01 12:24   ` Shijith Thotton
2022-07-03  7:31     ` Morten Brørup
2022-07-04 14:00       ` Bruce Richardson
2022-08-03 15:34         ` [EXT] " Shijith Thotton
2022-08-29 15:16           ` [PATCH v1 0/4] mbuf dynamic field expansion Shijith Thotton
2022-09-07 13:43             ` [PATCH v2 0/5] " Shijith Thotton
2022-09-21  9:43               ` David Marchand
2022-09-21 14:01                 ` [EXT] " Shijith Thotton
2022-09-21 13:56               ` [PATCH v3 " Shijith Thotton
2022-09-21 13:56                 ` [PATCH v3 1/5] build: add meson option to configure IOVA mode as VA Shijith Thotton
2022-09-28 12:52                   ` Olivier Matz
2022-09-29  5:48                     ` [EXT] " Shijith Thotton
2022-09-21 13:56                 ` [PATCH v3 2/5] mbuf: add second dynamic field member for VA only build Shijith Thotton
2022-09-28  7:24                   ` Thomas Monjalon
2022-09-28 12:52                     ` Olivier Matz
2022-09-28 19:33                       ` Thomas Monjalon
2022-09-28 19:48                       ` Stephen Hemminger
2022-09-29  6:13                         ` [EXT] " Shijith Thotton
2022-09-28 12:52                   ` Olivier Matz
2022-09-21 13:56                 ` [PATCH v3 3/5] lib: move mbuf next pointer to first cache line Shijith Thotton
2022-09-21 14:07                   ` Morten Brørup
2022-09-28 12:52                   ` Olivier Matz
2022-09-29  6:14                     ` [EXT] " Shijith Thotton
2022-09-21 13:56                 ` [PATCH v3 4/5] drivers: mark Marvell cnxk PMDs work with IOVA as VA Shijith Thotton
2022-09-28 12:53                   ` Olivier Matz
2022-09-29  6:19                     ` [EXT] " Shijith Thotton
2022-09-29  7:44                       ` Olivier Matz
2022-09-29  8:10                         ` Shijith Thotton
2022-10-07 20:17                   ` Olivier Matz
2022-10-07 20:22                     ` [EXT] " Shijith Thotton
2022-09-21 13:56                 ` [PATCH v3 5/5] drivers: mark software " Shijith Thotton
2022-09-28  5:41                 ` [PATCH v3 0/5] mbuf dynamic field expansion Shijith Thotton
2022-09-28 12:52                 ` Olivier Matz
2022-09-29  4:51                   ` [EXT] " Shijith Thotton
2022-10-07 13:50                 ` Thomas Monjalon
2022-10-07 19:35                   ` [EXT] " Shijith Thotton
2022-10-07 19:30                 ` [PATCH v4 0/7] " Shijith Thotton
2022-10-07 19:30                   ` [PATCH v4 1/7] mbuf: add API to get and set mbuf physical address Shijith Thotton
2022-10-07 20:16                     ` Olivier Matz
2022-10-07 20:20                       ` [EXT] " Shijith Thotton
2022-10-07 19:30                   ` [PATCH v4 2/7] test/dma: use API to get mbuf data " Shijith Thotton
2022-10-07 20:17                     ` Olivier Matz
2022-10-07 19:30                   ` [PATCH v4 3/7] build: add meson option to configure IOVA mode as PA Shijith Thotton
2022-10-07 19:30                   ` [PATCH v4 4/7] mbuf: add second dynamic field member Shijith Thotton
2022-10-07 19:30                   ` [PATCH v4 5/7] lib: move mbuf next pointer to first cache line Shijith Thotton
2022-10-07 19:30                   ` [PATCH v4 6/7] drivers: mark cnxk PMDs work with IOVA as PA disabled Shijith Thotton
2022-10-07 19:30                   ` [PATCH v4 7/7] drivers: mark software " Shijith Thotton
2022-10-07 20:19                   ` [PATCH v4 0/7] mbuf dynamic field expansion Olivier Matz
2022-10-07 21:02                   ` [PATCH v5 " Shijith Thotton
2022-10-07 21:02                     ` [PATCH v5 1/7] mbuf: add API to get and set mbuf physical address Shijith Thotton
2022-10-07 21:20                       ` Stephen Hemminger
2022-10-07 21:02                     ` [PATCH v5 2/7] test/dma: use API to get mbuf data " Shijith Thotton
2022-10-07 21:02                     ` [PATCH v5 3/7] build: add meson option to configure IOVA mode as PA Shijith Thotton
2022-10-07 21:02                     ` [PATCH v5 4/7] mbuf: add second dynamic field member Shijith Thotton
2022-10-07 21:02                     ` [PATCH v5 5/7] lib: move mbuf next pointer to first cache line Shijith Thotton
2022-10-07 21:22                       ` Stephen Hemminger
2022-10-07 21:30                         ` [EXT] " Shijith Thotton
2022-10-07 21:02                     ` [PATCH v5 6/7] drivers: mark cnxk PMDs work with IOVA as PA disabled Shijith Thotton
2022-10-07 21:02                     ` [PATCH v5 7/7] drivers: mark software " Shijith Thotton
2022-10-09  9:34                     ` [PATCH v5 0/7] mbuf dynamic field expansion Thomas Monjalon
2022-09-07 13:43             ` [PATCH v2 1/5] build: add meson option to configure IOVA mode as VA Shijith Thotton
2022-09-07 15:31               ` Stephen Hemminger
2022-09-07 15:38                 ` Bruce Richardson
2022-09-07 21:33                   ` Morten Brørup
2022-09-07 13:43             ` [PATCH v2 2/5] mbuf: add second dynamic field member for VA only build Shijith Thotton
2022-09-07 13:43             ` [PATCH v2 3/5] lib: move mbuf next pointer to first cache line Shijith Thotton
2022-09-07 13:43             ` [PATCH v2 4/5] drivers: mark Marvell cnxk PMDs work with IOVA as VA Shijith Thotton
2022-09-07 13:43             ` [PATCH v2 5/5] drivers: mark software " Shijith Thotton
2022-08-29 15:16           ` [PATCH v1 1/4] build: add meson option to configure IOVA mode " Shijith Thotton
2022-08-29 18:18             ` Morten Brørup
2022-08-30  8:32               ` Bruce Richardson [this message]
2022-08-29 15:16           ` [PATCH v1 2/4] mbuf: add second dynamic field member for VA only build Shijith Thotton
2022-08-29 18:32             ` Morten Brørup
2022-08-30  8:35               ` Bruce Richardson
2022-08-30  8:41                 ` [EXT] " Pavan Nikhilesh Bhagavatula
2022-08-30 13:22                   ` Honnappa Nagarahalli
2022-09-07 13:55                     ` Shijith Thotton
2022-08-29 15:16           ` [PATCH v1 3/4] drivers: mark Marvell cnxk PMDs work with IOVA as VA Shijith Thotton
2022-08-29 15:16           ` [PATCH v1 4/4] drivers: mark software " Shijith Thotton
2022-08-30 13:07     ` [PATCH] mbuf: add mbuf physical address field to dynamic field Ferruh Yigit
2022-09-12 13:19       ` [EXT] " Shijith Thotton
2022-06-30 16:55 ` Bruce Richardson
2022-07-01  9:48   ` Olivier Matz
2022-07-01 11:53     ` Slava Ovsiienko
2022-07-01 12:01     ` [EXT] " Shijith Thotton

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=Yw3LHFj2EcsQ7tTf@bricha3-MOBL.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=Honnappa.Nagarahalli@arm.com \
    --cc=chenbo.xia@intel.com \
    --cc=ciara.power@intel.com \
    --cc=dev@dpdk.org \
    --cc=fengchengwen@huawei.com \
    --cc=jerinj@marvell.com \
    --cc=kevin.laatz@intel.com \
    --cc=konstantin.v.ananyev@yandex.ru \
    --cc=maxime.coquelin@redhat.com \
    --cc=mb@smartsharesystems.com \
    --cc=nicolas.chautru@intel.com \
    --cc=olivier.matz@6wind.com \
    --cc=pbhagavatula@marvell.com \
    --cc=reshma.pattan@intel.com \
    --cc=stephen@networkplumber.org \
    --cc=sthotton@marvell.com \
    --cc=thomas@monjalon.net \
    /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).