DPDK patches and discussions
 help / color / mirror / Atom feed
From: Patrick Robb <probb@iol.unh.edu>
To: Shani Peretz <shperetz@nvidia.com>
Cc: dev@dpdk.org, thomas@monjalon.net
Subject: Re: [PATCH] eal: fix DMA mask validation inconsistency in IOVA VA
Date: Tue, 16 Sep 2025 09:15:38 -0400	[thread overview]
Message-ID: <CAJvnSUBtD-XRzn5x4q4WEhNZeXAcXPPbZQqh-4cdexVcpLhPBA@mail.gmail.com> (raw)
In-Reply-To: <20250908163456.420268-1-shperetz@nvidia.com>

[-- Attachment #1: Type: text/plain, Size: 4654 bytes --]

FYI The DTS failure for this series on patchwork for the MTU testsuite is
coming from a different patch than this one. Once I have that resolved, I
will put in a retest for this series which will clear up that MTU testsuite
failure.

On Mon, Sep 8, 2025 at 12:35 PM Shani Peretz <shperetz@nvidia.com> wrote:

> When --iova-mode is explicitly specified in command line, DMA mask
> constraints were not being validated, leading to potential runtime
> failures when device DMA capabilities are exceeded.
>
> The issue occurred because rte_bus_get_iommu_class() was only called
> during IOVA mode auto-detection, but this function has the important
> side effect of triggering DMA mask detection (e.g., Intel IOMMU
> address width checking via pci_device_iommu_support_va()).
>
> This created an inconsistency, when choosing explicit mode,
> the DMA checks are bypassed, but when choosing auto-detection mode,
> the constraints are checked and enforced.
>
> The fix moves rte_bus_get_iommu_class() outside the conditional logic
> to ensure it's always called during EAL initialization.
>
> Fixes: 4374ebc24bc1 ("malloc: modify error message for DMA mask check")
> Cc: stable@dpdk.org
>
> Signed-off-by: Shani Peretz <shperetz@nvidia.com>
> ---
>  lib/eal/freebsd/eal.c | 6 +++++-
>  lib/eal/linux/eal.c   | 5 ++++-
>  lib/eal/windows/eal.c | 5 ++++-
>  3 files changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
> index c1ab8d86d2..0f957919d3 100644
> --- a/lib/eal/freebsd/eal.c
> +++ b/lib/eal/freebsd/eal.c
> @@ -670,12 +670,16 @@ rte_eal_init(int argc, char **argv)
>          * with a message describing the cause.
>          */
>         has_phys_addr = internal_conf->no_hugetlbfs == 0;
> +
> +       /* Always call rte_bus_get_iommu_class() to trigger DMA mask
> detection and validation */
> +       enum rte_iova_mode bus_iova_mode = rte_bus_get_iommu_class();
> +
>         iova_mode = internal_conf->iova_mode;
>         if (iova_mode == RTE_IOVA_DC) {
>                 EAL_LOG(DEBUG, "Specific IOVA mode is not requested,
> autodetecting");
>                 if (has_phys_addr) {
>                         EAL_LOG(DEBUG, "Selecting IOVA mode according to
> bus requests");
> -                       iova_mode = rte_bus_get_iommu_class();
> +                       iova_mode = bus_iova_mode;
>                         if (iova_mode == RTE_IOVA_DC) {
>                                 if (!RTE_IOVA_IN_MBUF) {
>                                         iova_mode = RTE_IOVA_VA;
> diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
> index 52efb8626b..3a0c9c9db6 100644
> --- a/lib/eal/linux/eal.c
> +++ b/lib/eal/linux/eal.c
> @@ -1042,10 +1042,13 @@ rte_eal_init(int argc, char **argv)
>
>         phys_addrs = rte_eal_using_phys_addrs() != 0;
>
> +       /* Always call rte_bus_get_iommu_class() to trigger DMA mask
> detection and validation */
> +       enum rte_iova_mode bus_iova_mode = rte_bus_get_iommu_class();
> +
>         /* if no EAL option "--iova-mode=<pa|va>", use bus IOVA scheme */
>         if (internal_conf->iova_mode == RTE_IOVA_DC) {
>                 /* autodetect the IOVA mapping mode */
> -               enum rte_iova_mode iova_mode = rte_bus_get_iommu_class();
> +               enum rte_iova_mode iova_mode = bus_iova_mode;
>
>                 if (iova_mode == RTE_IOVA_DC) {
>                         EAL_LOG(DEBUG, "Buses did not request a specific
> IOVA mode.");
> diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c
> index 4f0a164d9b..2502ec3c3d 100644
> --- a/lib/eal/windows/eal.c
> +++ b/lib/eal/windows/eal.c
> @@ -348,12 +348,15 @@ rte_eal_init(int argc, char **argv)
>                 has_phys_addr = false;
>         }
>
> +       /* Always call rte_bus_get_iommu_class() to trigger DMA mask
> detection and validation */
> +       enum rte_iova_mode bus_iova_mode = rte_bus_get_iommu_class();
> +
>         iova_mode = internal_conf->iova_mode;
>         if (iova_mode == RTE_IOVA_DC) {
>                 EAL_LOG(DEBUG, "Specific IOVA mode is not requested,
> autodetecting");
>                 if (has_phys_addr) {
>                         EAL_LOG(DEBUG, "Selecting IOVA mode according to
> bus requests");
> -                       iova_mode = rte_bus_get_iommu_class();
> +                       iova_mode = bus_iova_mode;
>                         if (iova_mode == RTE_IOVA_DC) {
>                                 if (!RTE_IOVA_IN_MBUF) {
>                                         iova_mode = RTE_IOVA_VA;
> --
> 2.34.1
>
>

[-- Attachment #2: Type: text/html, Size: 5651 bytes --]

  parent reply	other threads:[~2025-09-16 13:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-08 16:34 Shani Peretz
2025-09-09 10:17 ` Burakov, Anatoly
2025-09-16 13:15 ` Patrick Robb [this message]
2025-09-17  8:49 ` Thomas Monjalon

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=CAJvnSUBtD-XRzn5x4q4WEhNZeXAcXPPbZQqh-4cdexVcpLhPBA@mail.gmail.com \
    --to=probb@iol.unh.edu \
    --cc=dev@dpdk.org \
    --cc=shperetz@nvidia.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).