From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
To: Hyong Youb Kim <hyonkim@cisco.com>,
Ferruh Yigit <ferruh.yigit@intel.com>,
David Marchand <david.marchand@redhat.com>,
Thomas Monjalon <thomas@monjalon.net>
Cc: dev@dpdk.org, John Daley <johndale@cisco.com>
Subject: Re: [dpdk-dev] [PATCH] bus/pci: fix mapping BAR containing MSI-X table
Date: Fri, 25 Sep 2020 12:48:54 +0100 [thread overview]
Message-ID: <65af599a-e5e1-a01c-1b83-6f22a680abaa@intel.com> (raw)
In-Reply-To: <20200925021435.16114-1-hyonkim@cisco.com>
On 25-Sep-20 3:14 AM, Hyong Youb Kim wrote:
> When the BAR contains MSI-X table, pci_vfio_mmap_bar() tries to skip
> the table and map the rest. "map around it" is the phrase used in the
> source. The function splits the BAR into two regions: the region
> before the table (first part or memreg[0]) and the region after the
> table (second part or memreg[1]).
>
> For hardware that has MSI-X vector table offset 0, the first part does
> not exist (memreg[0].size == 0).
>
> Capabilities: [60] MSI-X: Enable- Count=48 Masked-
> Vector table: BAR=2 offset=00000000
> PBA: BAR=2 offset=00001000
>
> The mapping part of the function maps the first part, if it
> exists. Then, it maps the second part, if it exists and "if mapping the
> first part succeeded".
>
> The recent change that replaces MAP_FAILED with NULL breaks the "if
> mapping the first part succeeded" condition (1) in the snippet below.
>
> void *map_addr = NULL;
> if (memreg[0].size) {
> /* actual map of first part */
> map_addr = pci_map_resource(...);
> }
>
> /* if there's a second part, try to map it */
> if (map_addr != NULL // -- (1)
> && memreg[1].offset && memreg[1].size) {
> [...]
> }
>
> if (map_addr == NULL) {
> RTE_LOG(ERR, EAL, "Failed to map pci BAR%d\n",
> bar_index);
> return -1;
> }
>
> When the first part does not exist, (1) sees map_addr is still NULL,
> and the function fails. This behavior is a regression and fails
> probing hardware with vector table offset 0.
>
> Previously, (1) was "map_addr != MAP_FAILED", which meant
> pci_map_resource() was actually attempted and failed. So, expand (1)
> to check if the first part exists as well, to match the semantics of
> MAP_FAILED.
>
> Bugzilla ID: 539
> Fixes: e200535c1ca3 ("mem: drop mapping API workaround")
>
> Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
> ---
LGTM
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
--
Thanks,
Anatoly
next prev parent reply other threads:[~2020-09-25 11:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-25 2:14 Hyong Youb Kim
2020-09-25 11:48 ` Burakov, Anatoly [this message]
2020-09-28 9:42 ` David Marchand
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=65af599a-e5e1-a01c-1b83-6f22a680abaa@intel.com \
--to=anatoly.burakov@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=hyonkim@cisco.com \
--cc=johndale@cisco.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).