lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200207124831.391d5f70@w520.home>
Date:   Fri, 7 Feb 2020 12:48:31 -0700
From:   Alex Williamson <alex.williamson@...hat.com>
To:     Yan Zhao <yan.y.zhao@...el.com>
Cc:     kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
        cohuck@...hat.com, zhenyuw@...ux.intel.com, zhi.a.wang@...el.com,
        kevin.tian@...el.com, shaopeng.he@...el.com, yi.l.liu@...el.com
Subject: Re: [RFC PATCH v2 1/9] vfio/pci: split vfio_pci_device into public
 and private parts

On Thu, 30 Jan 2020 21:09:56 -0500
Yan Zhao <yan.y.zhao@...el.com> wrote:

> split vfio_pci_device into two parts:
> (1) a public part,
>     including pdev, num_region, irq_type which are accessible from
>     outside of vfio.
> (2) a private part,
>     a pointer to vfio_pci_device_private, only accessible within vfio
> 
> Cc: Kevin Tian <kevin.tian@...el.com>
> Signed-off-by: Yan Zhao <yan.y.zhao@...el.com>
> ---
>  drivers/vfio/pci/vfio_pci.c         | 209 +++++++++++++++-------------
>  drivers/vfio/pci/vfio_pci_config.c  | 157 +++++++++++----------
>  drivers/vfio/pci/vfio_pci_igd.c     |  16 +--
>  drivers/vfio/pci/vfio_pci_intrs.c   | 171 ++++++++++++-----------
>  drivers/vfio/pci/vfio_pci_nvlink2.c |  16 +--
>  drivers/vfio/pci/vfio_pci_private.h |   5 +-
>  drivers/vfio/pci/vfio_pci_rdwr.c    |  36 ++---
>  include/linux/vfio.h                |   7 +
>  8 files changed, 321 insertions(+), 296 deletions(-)

I think the typical solution to something like this would be...

struct vfio_pci_device {
	...
};

struct vfio_pci_device_private {
	struct vfio_pci_device vdev;
	...
};

External code would be able to work with the vfio_pci_device and
internal code would do a container_of() to get access to the private
fields.  What's done here is pretty ugly and not very cache friendly.
Thanks,

Alex

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ