DPDK CI discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: "Zhang, AlvinX" <alvinx.zhang@intel.com>, anatoly.burakov@intel.com
Cc: dev@dpdk.org, Beilei Xing <beilei.xing@intel.com>,
	Jeff Guo <jia.guo@intel.com>,
	David Marchand <david.marchand@redhat.com>,
	ci@dpdk.org, ferruh.yigit@intel.com, bruce.richardson@intel.com,
	talshn@mellanox.com
Subject: Re: [dpdk-ci] [dpdk-dev] [PATCH] bus/pci: fix mmap PCI resource
Date: Fri, 10 Jul 2020 14:31:34 +0200	[thread overview]
Message-ID: <4953813.kqYPlVRg1Q@thomas> (raw)
In-Reply-To: <3033441.08XpM1RNeG@thomas>

10/07/2020 12:07, Thomas Monjalon:
> 10/07/2020 11:54, David Marchand:
> > On Wed, Jul 8, 2020 at 11:26 AM <alvinx.zhang@intel.com> wrote:
> > > From: Alvin Zhang <alvinx.zhang@intel.com>
> > >
> > > When mapping a PCI BAR containing an MSI-X table, some devices do not
> > > need to actually map this BAR or only need to map part of them, which
> > > may cause the mapping to fail. Now some checks are added and a non-NULL
> > > initial value is set to the variable to avoid this situation.
[...]
> > > --- a/drivers/bus/pci/linux/pci_vfio.c
> > > +++ b/drivers/bus/pci/linux/pci_vfio.c
> > > @@ -547,6 +547,14 @@
> > >                         bar_index,
> > >                         memreg[0].offset, memreg[0].size,
> > >                         memreg[1].offset, memreg[1].size);
> > > +
> > > +               if (memreg[0].size == 0 && memreg[1].size == 0) {
> > > +                       /* No need to map this BAR */
> > > +                       RTE_LOG(DEBUG, EAL, "Skipping BAR%d\n", bar_index);
> > > +                       bar->size = 0;
> > > +                       bar->addr = 0;
> > > +                       return 0;
> > > +               }
> > 
> > We already have a check on bar size == 0.
> > Why would we have this condition?
> > Broken hw?
> > 
> > 
> > >         } else {
> > >                 memreg[0].offset = bar->offset;
> > >                 memreg[0].size = bar->size;
> > > @@ -556,7 +564,9 @@
> > >         bar_addr = mmap(bar->addr, bar->size, 0, MAP_PRIVATE |
> > >                         MAP_ANONYMOUS | additional_flags, -1, 0);
> > >         if (bar_addr != MAP_FAILED) {
> > > -               void *map_addr = NULL;
> > > +               /* Set non NULL initial value for in case of no PCI mapping */
> > > +               void *map_addr = bar_addr;
> > > +
> > 
> > It took me some time to understand this code...
> > Anyway, we have a regression in the librte_pci.
> > This is where the fix should be.
> 
> Yes, I am going to send a fix.

Patch sent: https://patches.dpdk.org/patch/73741/

This patch is marked as rejected, but please follow-up on cleanup.

> > We can cleanup this code later.
> 
> Yes please, this function isn't understandable and lack of comments.
> Anatoly please?




  reply	other threads:[~2020-07-10 12:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200708092435.9776-1-alvinx.zhang@intel.com>
     [not found] ` <CAJFAV8xNh2XHS1YO4TwAi54_UAVaYj60jwAovnqgaPySS3yKbQ@mail.gmail.com>
2020-07-10 10:07   ` Thomas Monjalon
2020-07-10 12:31     ` Thomas Monjalon [this message]
2020-07-10 12:43     ` Lincoln Lavoie

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=4953813.kqYPlVRg1Q@thomas \
    --to=thomas@monjalon.net \
    --cc=alvinx.zhang@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=ci@dpdk.org \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jia.guo@intel.com \
    --cc=talshn@mellanox.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).