DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pavan Nikhilesh Bhagavatula <pbhagavatula@marvell.com>
To: "Burakov, Anatoly" <anatoly.burakov@intel.com>,
	Andrew Rybchenko <arybchenko@solarflare.com>,
	Jerin Jacob Kollanukkaran <jerinj@marvell.com>,
	"thomas@monjalon.net" <thomas@monjalon.net>,
	"ferruh.yigit@intel.com" <ferruh.yigit@intel.com>,
	"stephen@networkplumber.org" <stephen@networkplumber.org>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [EXT] Re: [PATCH] ethdev: fix DMA zone reserve not honoring size
Date: Mon, 1 Apr 2019 12:12:52 +0000	[thread overview]
Message-ID: <CY4PR1801MB186368C0AFB7C99FB6248A12DE550@CY4PR1801MB1863.namprd18.prod.outlook.com> (raw)
Message-ID: <20190401121252.kSco0L605nCy-Om-HZTVQdBYihqSB_ZRuJmuV3385oY@z> (raw)
In-Reply-To: <8bce9dd4-4879-db22-41ad-cc584c7afee8@intel.com>



> -----Original Message-----
> From: Burakov, Anatoly <anatoly.burakov@intel.com>
> Sent: Monday, April 1, 2019 3:11 PM
> To: Andrew Rybchenko <arybchenko@solarflare.com>; Pavan Nikhilesh
> Bhagavatula <pbhagavatula@marvell.com>; Jerin Jacob Kollanukkaran
> <jerinj@marvell.com>; thomas@monjalon.net; ferruh.yigit@intel.com;
> stephen@networkplumber.org
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: [EXT] Re: [dpdk-dev] [PATCH] ethdev: fix DMA zone reserve not
> honoring size
> 
> External Email
> 
> ----------------------------------------------------------------------
> On 01-Apr-19 10:28 AM, Burakov, Anatoly wrote:
> > On 01-Apr-19 8:30 AM, Andrew Rybchenko wrote:
> >> On 3/31/19 7:25 PM, Pavan Nikhilesh Bhagavatula wrote:
> >>> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
> >>>
> >>> The `rte_eth_dma_zone_reserve()` is generally used to create HW rings.
> >>> In some scenarios when a driver needs to reconfigure the ring size
> >>> since the named memzone already exists it returns the previous
> >>> memzone without checking if a different sized ring is requested.
> >>>
> >>> Introduce a check to see if the ring size requested is different
> >>> from the previously created memzone length.
> >>>
> >>> Fixes: 719dbebceb81 ("xen: allow determining DOM0 at runtime")
> >>> Cc: stable@dpdk.org
> >>>
> >>> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
> >>> ---
> >>>   lib/librte_ethdev/rte_ethdev.c | 5 ++++-
> >>>   1 file changed, 4 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/lib/librte_ethdev/rte_ethdev.c
> >>> b/lib/librte_ethdev/rte_ethdev.c index 12b66b68c..4ae12e43b 100644
> >>> --- a/lib/librte_ethdev/rte_ethdev.c
> >>> +++ b/lib/librte_ethdev/rte_ethdev.c
> >>> @@ -3604,9 +3604,12 @@ rte_eth_dma_zone_reserve(const struct
> >>> rte_eth_dev *dev, const char *ring_name,
> >>>       }
> >>>       mz = rte_memzone_lookup(z_name);
> >>> -    if (mz)
> >>> +    if (mz && (mz->len == size))
> >>>           return mz;
> >>> +    if (mz)
> >>> +        rte_memzone_free(mz);
> >>
> >> NACK
> >> I really don't like that API which should reserve does free if
> >> requested size does not match previously allocated.
> >> I understand the motivation, but I don't think the solution is correct.
> >
> > Why does size change in the first place?
> 
> Never mind, i forgot that NICs can be reconfigured :)
> 

😊

> Currently, there is no way to resize memzones, so freeing and reallocating is
> the only option. Since memzones are backed by regular malloc elements, we
> could add a memzone_resize API. That would help, because all of the
> references to the memzone itself will still be valid, even if memory ends up
> being reallocated.
> 

Agreed, but currently the following drivers use dma_zone_reserve API

drivers/net/iavf
drivers/net/e1000
drivers/net/bnx2x
drivers/net/nfp
drivers/net/atlantic
drivers/net/vmxnet3
drivers/net/thunderx
drivers/net/liquidio
drivers/net/sfc
drivers/net/ixgbe
drivers/net/axgbe
drivers/net/fm10k
drivers/net/i40e
drivers/net/ice

Most of them have a notion that dma_zone_reserve allocates the correct size.
(Although Most of the Intel NIC reserve max possible ring size).

Can we have the free and reserve for this release and move it to resize in the next?
AFAIK most of the existing drivers don’t have a different path for reconfigure and since it is same as configure they 
propagate the dma zone address properly.

> >
> >>
> >>> +
> >>>       return rte_memzone_reserve_aligned(z_name, size, socket_id,
> >>>               RTE_MEMZONE_IOVA_CONTIG, align);
> >>>   }
> >>
> >>
> >
> >
> 
> 
> --
> Thanks,
> Anatoly

  parent reply	other threads:[~2019-04-01 12:13 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-31 16:25 [dpdk-dev] " Pavan Nikhilesh Bhagavatula
2019-03-31 16:25 ` Pavan Nikhilesh Bhagavatula
2019-04-01  7:30 ` Andrew Rybchenko
2019-04-01  7:30   ` Andrew Rybchenko
2019-04-01  9:28   ` Burakov, Anatoly
2019-04-01  9:28     ` Burakov, Anatoly
2019-04-01  9:40     ` Burakov, Anatoly
2019-04-01  9:40       ` Burakov, Anatoly
2019-04-01 12:12       ` Pavan Nikhilesh Bhagavatula [this message]
2019-04-01 12:12         ` [dpdk-dev] [EXT] " Pavan Nikhilesh Bhagavatula
2019-04-02  0:47   ` Jerin Jacob Kollanukkaran
2019-04-02  0:47     ` Jerin Jacob Kollanukkaran
2019-04-02  7:36     ` Andrew Rybchenko
2019-04-02  7:36       ` Andrew Rybchenko
2019-04-02  8:25       ` Jerin Jacob Kollanukkaran
2019-04-02  8:25         ` Jerin Jacob Kollanukkaran
2019-04-02  8:44         ` Andrew Rybchenko
2019-04-02  8:44           ` Andrew Rybchenko
2019-04-04 22:23           ` Thomas Monjalon
2019-04-04 22:23             ` Thomas Monjalon
2019-04-05  8:03             ` Andrew Rybchenko
2019-04-05  8:03               ` Andrew Rybchenko

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=CY4PR1801MB186368C0AFB7C99FB6248A12DE550@CY4PR1801MB1863.namprd18.prod.outlook.com \
    --to=pbhagavatula@marvell.com \
    --cc=anatoly.burakov@intel.com \
    --cc=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jerinj@marvell.com \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.org \
    --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).