* [dpdk-dev] [bug] dpdk-vfio: Invalid region/index assumption
@ 2016-07-27 22:14 Alex Williamson
2016-07-28 6:54 ` Thomas Monjalon
2016-07-28 8:06 ` Santosh Shukla
0 siblings, 2 replies; 5+ messages in thread
From: Alex Williamson @ 2016-07-27 22:14 UTC (permalink / raw)
To: anatoly.burakov; +Cc: dev
Hi,
I took a quick look at the dpdk vfio code and spotted an invalid
assumption that should probably be corrected ASAP. That is:
lib/librte_eal/linuxapp/eal/eal_vfio.h:
#define VFIO_GET_REGION_ADDR(x) ((uint64_t) x << 40ULL)
#define VFIO_GET_REGION_IDX(x) (x >> 40)
Region offset to index is an implementation detail of the kernel, the
vfio API defines that the offset of a given region (BAR) is found via
the offset field of struct vfio_region_info returned via the
VFIO_DEVICE_GET_REGION_INFO ioctl. You're free to cache the offset
into any sort of local variable you like, but the kernel may change the
implementation of region index to offset at any point in time. This is
explicitly not part of the ABI. Is there a place to file a bug, or is
this sufficient? Thanks,
Alex
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [bug] dpdk-vfio: Invalid region/index assumption
2016-07-27 22:14 [dpdk-dev] [bug] dpdk-vfio: Invalid region/index assumption Alex Williamson
@ 2016-07-28 6:54 ` Thomas Monjalon
2016-07-28 9:42 ` Burakov, Anatoly
2016-07-28 8:06 ` Santosh Shukla
1 sibling, 1 reply; 5+ messages in thread
From: Thomas Monjalon @ 2016-07-28 6:54 UTC (permalink / raw)
To: Alex Williamson; +Cc: dev, anatoly.burakov
Hi,
2016-07-27 16:14, Alex Williamson:
> I took a quick look at the dpdk vfio code and spotted an invalid
> assumption that should probably be corrected ASAP.
It can theoretically be a bug but the value may never change in the kernel,
right?
So when you say ASAP, I feel it can wait the next DPDK release
(we plan to release today).
Do you agree?
> That is:
>
> lib/librte_eal/linuxapp/eal/eal_vfio.h:
> #define VFIO_GET_REGION_ADDR(x) ((uint64_t) x << 40ULL)
> #define VFIO_GET_REGION_IDX(x) (x >> 40)
>
> Region offset to index is an implementation detail of the kernel, the
> vfio API defines that the offset of a given region (BAR) is found via
> the offset field of struct vfio_region_info returned via the
> VFIO_DEVICE_GET_REGION_INFO ioctl. You're free to cache the offset
> into any sort of local variable you like, but the kernel may change the
> implementation of region index to offset at any point in time. This is
> explicitly not part of the ABI. Is there a place to file a bug, or is
> this sufficient? Thanks,
Thanks for the report. This email is sufficient :)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [bug] dpdk-vfio: Invalid region/index assumption
2016-07-28 6:54 ` Thomas Monjalon
@ 2016-07-28 9:42 ` Burakov, Anatoly
2016-07-28 14:54 ` Alex Williamson
0 siblings, 1 reply; 5+ messages in thread
From: Burakov, Anatoly @ 2016-07-28 9:42 UTC (permalink / raw)
To: Thomas Monjalon, Alex Williamson; +Cc: dev
> Hi,
>
> 2016-07-27 16:14, Alex Williamson:
> > I took a quick look at the dpdk vfio code and spotted an invalid
> > assumption that should probably be corrected ASAP.
>
> It can theoretically be a bug but the value may never change in the kernel,
> right?
> So when you say ASAP, I feel it can wait the next DPDK release (we plan to
> release today).
> Do you agree?
Unless there are imminent plans to change this in the kernel, I think it can wait for next release.
Thanks,
Anatoly
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [bug] dpdk-vfio: Invalid region/index assumption
2016-07-28 9:42 ` Burakov, Anatoly
@ 2016-07-28 14:54 ` Alex Williamson
0 siblings, 0 replies; 5+ messages in thread
From: Alex Williamson @ 2016-07-28 14:54 UTC (permalink / raw)
To: Burakov, Anatoly; +Cc: Thomas Monjalon, dev
On Thu, 28 Jul 2016 09:42:13 +0000
"Burakov, Anatoly" <anatoly.burakov@intel.com> wrote:
> > Hi,
> >
> > 2016-07-27 16:14, Alex Williamson:
> > > I took a quick look at the dpdk vfio code and spotted an invalid
> > > assumption that should probably be corrected ASAP.
> >
> > It can theoretically be a bug but the value may never change in the kernel,
> > right?
> > So when you say ASAP, I feel it can wait the next DPDK release (we plan to
> > release today).
> > Do you agree?
>
> Unless there are imminent plans to change this in the kernel, I think it can wait for next release.
I don't have any plans to change it, but this relationship is not a
guaranteed part of the ABI. I reserve the right to make such changes
in the future. Thanks,
Alex
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [bug] dpdk-vfio: Invalid region/index assumption
2016-07-27 22:14 [dpdk-dev] [bug] dpdk-vfio: Invalid region/index assumption Alex Williamson
2016-07-28 6:54 ` Thomas Monjalon
@ 2016-07-28 8:06 ` Santosh Shukla
1 sibling, 0 replies; 5+ messages in thread
From: Santosh Shukla @ 2016-07-28 8:06 UTC (permalink / raw)
To: Alex Williamson; +Cc: anatoly.burakov, dev
On Thu, Jul 28, 2016 at 03:44:57AM +0530, Alex Williamson wrote:
> Hi,
>
> I took a quick look at the dpdk vfio code and spotted an invalid
> assumption that should probably be corrected ASAP. That is:
>
> lib/librte_eal/linuxapp/eal/eal_vfio.h:
> #define VFIO_GET_REGION_ADDR(x) ((uint64_t) x << 40ULL)
> #define VFIO_GET_REGION_IDX(x) (x >> 40)
Yes. I agree. We need some way to carry essential vfio region info in pci_dev,
needed for pread/pwrite. currently, rte_intr_handle only has vfio_dev_fd but
thats not sufficient information. I stumbled while adding ioport support in vfio
and took a short path to define region_idx thatway. To get-rid of this, Possible
approach could be;
- add essential vfio region specific info (ie.. offset, idx, flag) in
rte_intr_handle.
- or pull dev_fd to rte_pci_device{}; and define region specific details.
Thanks.
> Region offset to index is an implementation detail of the kernel, the
> vfio API defines that the offset of a given region (BAR) is found via
> the offset field of struct vfio_region_info returned via the
> VFIO_DEVICE_GET_REGION_INFO ioctl. You're free to cache the offset
> into any sort of local variable you like, but the kernel may change the
> implementation of region index to offset at any point in time. This is
> explicitly not part of the ABI. Is there a place to file a bug, or is
> this sufficient? Thanks,
>
> Alex
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-07-28 14:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-27 22:14 [dpdk-dev] [bug] dpdk-vfio: Invalid region/index assumption Alex Williamson
2016-07-28 6:54 ` Thomas Monjalon
2016-07-28 9:42 ` Burakov, Anatoly
2016-07-28 14:54 ` Alex Williamson
2016-07-28 8:06 ` Santosh Shukla
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).