DPDK patches and discussions
 help / color / mirror / Atom feed
From: dwilder <dwilder@us.ibm.com>
To: Jerin Jacob <jerinjacobk@gmail.com>
Cc: Aaron Conole <aconole@redhat.com>,
	Michael Santana <maicolgabriel@hotmail.com>,
	Thomas Monjalon <thomas@monjalon.net>,
	Ferruh Yigit <ferruh.yigit@intel.com>,
	Andrew Rybchenko <arybchenko@solarflare.com>,
	dpdk-dev <dev@dpdk.org>,
	"Ruifeng Wang (Arm Technology China)" <ruifeng.wang@arm.com>,
	David Marchand <david.marchand@redhat.com>,
	David Christensen <drc@linux.vnet.ibm.com>,
	David Wilder <wilder@us.ibm.com>
Subject: Re: [dpdk-dev] [PATCH v3 1/3] eal/linux: select iova-mode va with no-huge option
Date: Tue, 24 Mar 2020 15:34:32 -0700	[thread overview]
Message-ID: <1ef03cdb4ab3e66820a595cac0332cc3@linux.vnet.ibm.com> (raw)
In-Reply-To: <CALBAE1MwmXj-WqxXYdWJ4frQQh-sZSUhT3tigpn0KpKy6Faw2A@mail.gmail.com>

On 2020-03-23 23:19, Jerin Jacob wrote:
> On Mon, Mar 23, 2020 at 11:11 PM dwilder <dwilder@us.ibm.com> wrote:
>> 
>> Thanks you for your review Jerin.  See my responses are inline.
>> 
>> On 2020-03-20 06:24, Jerin Jacob wrote:
>> > On Fri, Feb 21, 2020 at 4:22 AM David Wilder <dwilder@us.ibm.com>
>> > wrote:
>> >>
>> >> If --no-huge is set and iova-mode has not been specified force VA
>> >> mode.
>> >> If --no-huge and --iova-mode=PA is requested error out as this is
>> >> an impossible configuration.
>> >>
>> >> Signed-off-by: David Wilder <dwilder@us.ibm.com>
>> >> ---
>> >>  lib/librte_eal/linux/eal/eal.c | 14 ++++++++++++++
>> >>  1 file changed, 14 insertions(+)
>> >>
>> >> diff --git a/lib/librte_eal/linux/eal/eal.c
>> >> b/lib/librte_eal/linux/eal/eal.c
>> >> index 9530ee55f..d3a0a1731 100644
>> >> --- a/lib/librte_eal/linux/eal/eal.c
>> >> +++ b/lib/librte_eal/linux/eal/eal.c
>> >> @@ -1062,9 +1062,16 @@ rte_eal_init(int argc, char **argv)
>> >>
>> >>         /* if no EAL option "--iova-mode=<pa|va>", use bus IOVA scheme
>> >> */
>> >>         if (internal_config.iova_mode == RTE_IOVA_DC) {
>> >> +
>> >>                 /* autodetect the IOVA mapping mode */
>> >>                 enum rte_iova_mode iova_mode =
>> >> rte_bus_get_iommu_class();
>> >>
>> >> +               if (iova_mode == RTE_IOVA_PA &&
>> >> !rte_eal_has_hugepages()) {
>> >> +                       iova_mode = RTE_IOVA_VA;
>> 
>> >
>> > What if igb_uio or vfio_nommu has been loaded(i.e no iommu support
>> > enabled from the driver)? This would fail.
>> 
>> Yes they would fail.  If igb_uio or vfio_nommu (or any driver) cant be
>> forced to VA mode it cant be used with out hugepages.  Drivers can be
>> available but not used therefor we print a warning message.
> 
> I think, the warning will not be enough as the system will fail anyway.
> 
> iova_mode == RTE_IOVA_PA && rte_eal_has_hugepages() == 0 && no_iommu == 
> 1
> case, we need to return error.
> 
> iova_mode == RTE_IOVA_PA && rte_eal_has_hugepages() == 0 && no_iommu == 
> 0
> case warning is enough.

The current code will skip the bus if iova-mode is not supported,  this 
allow other devices to continu on.  The handing of an unsupported 
iova-mode is done in rte_pci_probe_one_driver(). See also 
rte_bus_get_iommu_class() if multiple busses cant agree on iova-mode a 
warning is given.

Here I have bound 0002:01:00.1 to igb_uio and forced iova-mode=pa,  much 
as my code did when --no-huge is used.

./dpdk-devbind.py -s
0002:01:00.1 'Ethernet Controller X710/X557-AT 10GBASE-T 1589' 
drv=igb_uio unused=i40e
<....>
dpdk-testpmd -c 3  --iova-mode=va -w 0002:01:00.1 -- -ia
EAL: Detected 160 lcore(s)
EAL: Detected 2 NUMA nodes
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'VA'
EAL: No available hugepages reported in hugepages-2048kB
EAL: Probing VFIO support...
EAL: PCI device 0002:01:00.1 on NUMA socket 0
EAL:   probe driver: 8086:1589 net_i40e
EAL:   Expecting 'PA' IOVA mode but current mode is 'VA', not 
initializing  <<<<<<<<<
EAL: Requested device 0002:01:00.1 cannot be used
<.....>


>> 
>> >
>> >> +                       RTE_LOG(WARNING, EAL, "Some buses want 'PA'
>> >> but forcing 'VA' because --no-huge is requested.\n");
>> >> +                       RTE_LOG(WARNING, EAL, "Not all buses may be
>> >> able to initialize.\n");
>> >> +               }
>> >> +
>> >>                 if (iova_mode == RTE_IOVA_DC) {
>> >>                         RTE_LOG(DEBUG, EAL, "Buses did not request a
>> >> specific IOVA mode.\n");
>> >>
>> >> @@ -1111,6 +1118,13 @@ rte_eal_init(int argc, char **argv)
>> >>                         internal_config.iova_mode;
>> >>         }
>> >>
>> >> +       if (rte_eal_iova_mode() == RTE_IOVA_PA &&
>> >> +           rte_eal_has_hugepages() == 0) {
>> >> +               rte_eal_init_alert("Cannot use IOVA as 'PA' with
>> >> --no-huge");
>> >
>> > Top of the tree already detecting this case. am I missing anything?
>> >
>> > [master]dell[dpdk.org] $ sudo ./build/app/test/dpdk-test  -c 0x3
>> > --no-huge --iova-mode=pa
>> > EAL: Detected 56 lcore(s)
>> > EAL: Detected 2 NUMA nodes
>> > EAL: Static memory layout is selected, amount of reserved memory can
>> > be adjusted with -m or --socket-mem
>> > EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
>> > EAL: FATAL: Cannot use IOVA as 'PA' since physical addresses are not
>> > available
>> > EAL: Cannot use IOVA as 'PA' since physical addresses are not available
>> >
>> 
>> The check you reference is reporting that physical address are not
>> available, for example no permissions to read /proc/self/pagemap.  In
>> this case, if --no-huge is set then PA mode is not allowed. There is 
>> no
>> guarantee that physical address are persistent with out using 
>> hugepages.
> 
> Since this check is under the following, Yes, make sense for the check.
> The old command has explicit  --iova-mode=pa. So it is in the
> different code paths.
> 
> /* if no EAL option "--iova-mode=<pa|va>", use bus IOVA scheme */
>         if (internal_config.iova_mode == RTE_IOVA_DC) {
> 
>> 
>> 
>> >> +               rte_errno = EINVAL;
>> >> +               return -1;
>> >> +       }
>> >> +
>> >>         if (rte_eal_iova_mode() == RTE_IOVA_PA && !phys_addrs) {
>> >>                 rte_eal_init_alert("Cannot use IOVA as 'PA' since
>> >> physical addresses are not available");
>> >>                 rte_errno = EINVAL;
>> >> --
>> >> 2.25.0
>> >>

  reply	other threads:[~2020-03-24 22:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-20 22:52 [dpdk-dev] [PATCH v3 0/3] add travis ci support for ppc64le David Wilder
2020-02-20 22:52 ` [dpdk-dev] [PATCH v3 1/3] eal/linux: select iova-mode va with no-huge option David Wilder
2020-03-20 13:24   ` Jerin Jacob
2020-03-23 17:40     ` dwilder
2020-03-24  6:19       ` Jerin Jacob
2020-03-24 22:34         ` dwilder [this message]
2020-03-25 21:05         ` dwilder
2020-02-20 22:52 ` [dpdk-dev] [PATCH v3 2/3] devtools: allow test-null.sh to run on ppc64le David Wilder
2020-02-20 22:52 ` [dpdk-dev] [PATCH v3 3/3] ci: add travis ci support for native ppc64le David Wilder

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=1ef03cdb4ab3e66820a595cac0332cc3@linux.vnet.ibm.com \
    --to=dwilder@us.ibm.com \
    --cc=aconole@redhat.com \
    --cc=arybchenko@solarflare.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=drc@linux.vnet.ibm.com \
    --cc=ferruh.yigit@intel.com \
    --cc=jerinjacobk@gmail.com \
    --cc=maicolgabriel@hotmail.com \
    --cc=ruifeng.wang@arm.com \
    --cc=thomas@monjalon.net \
    --cc=wilder@us.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).