From: Shuah Khan <shuah@kernel.org>
To: Salvador Fandino <salva@qindel.com>, linux-usb@vger.kernel.org
Cc: gregkh@linuxfoundation.org, valentina.manea.m@gmail.com,
linux-kernel@vger.kernel.org,
Shuah Khan <shuahkh@osg.samsung.com>,
Shuah Khan <shuah@kernel.org>
Subject: Re: [PATH 0/4] usbip: make vhci_hcd.* objects independent of vhci_hcd.0
Date: Mon, 5 Feb 2018 08:16:24 -0700 [thread overview]
Message-ID: <de022e9c-c42b-9af9-b118-6f7de336dc66@kernel.org> (raw)
In-Reply-To: <20180130083630.26501-1-salva@qindel.com>
On 01/30/2018 01:36 AM, Salvador Fandino wrote:
> Let me start by explaining the problem that have motivated me to write
> this patches:
>
> I work on the QVD, a virtual desktop platform for Linux. This software
> runs Linux desktops (i.e. XFCE, KDE) and their applications inside LXC
> containers, and makes then available through the network to remote
> users.
>
> Supporting USB devices is a common feature customers have been
> requesting us for a long time (in order to use, for instance, remote
> signature pads, bar-code scanners, fingerprint readers, etc.). So, we
> have been working on that feature using the USB/IP layer on the
> kernel.
>
> Connecting and disconnecting devices and transferring data works
> seamless for the devices listed above. But we also want to make the
> usbip operations private to the container where they are run. For
> instance, it is unacceptable for our product, that one user could list
> the devices connected by other users or access them.
>
> We can control how can access every device using cgroups once those
> are attached, but the usbip layer is not providing any mechanism for
> controlling who can attach, detach or list the devices.
>
> So, we got the idea that in order to enforce that remote usbip devices
> are only visible inside the container where they were imported, we
> could conveniently mount-bind inside every container just one of the
> vhci_hcd directories below /sys/devices/platform. So that it is as if
> every container had a vhci_hcd just for itself (and also, we restrict
> access to the matching USB ports in cgroups).
>
> Unfortunately, all the vhci_hcd.* devices are controlled through
> attributes in vhci_hcd.0 making our approach fail and so... well, that
> is what this patch series changes. It makes every vhci_hcd device
> controllable through attributes inside its own sysfs directory.
>
> The first patch, does that in the kernel, and the second and third
> patches change user space, adapting the libusbip and the usbip tools
> code respectively.
>
> Then there is a fourth patch, that allows to create much more USB
> hubs per machine. It was limited to 64 and we are running thousands of
> containers (every one requiring a hub) per host.
>
> These changes are not completely backward compatible. In the sysfs
> side, besides moving around the attribute files, now the port numbers
> go from 0 to CONFIG_USBIP_VHCI_HC_PORTS * 2 - 1 and are reused for
> every vhci_hcd device. I could have maintained the absolute numeration
> but I think reusing the numbers is a better and simpler approach.
>
> I have considered that until very recently, support for vhci_hcd
> devices above the .0 was broken in the uspip tools (see
> 1ac7c8a78be85f84b019d3d2742d1a9f07255cc5 "usbip: fix usbip attach to
> find a port that matches the requested speed") and that has been the
> place where I have set the bar for backward compatibility: usage of
> the tools must remain unchanged for accessing "vhci_hcd.0", but may
> require changes otherwise. The same is true for the library functions
> which now provides new functions for selecting the target vhci_hcd
> device. The old functions now always target "vhci_hcd.0".
>
> So, for instance, now, "usbip port" by default only shows "vhci_hcd.0"
> ports but "usbip port -a" shows all of them, and, for instance, "usbip
> port -i 4", shows the ports in "vhci_hcd.4".
>
> Cheers.
>
I will take a look at these in the next week or so.
thanks,
-- Shuah
next prev parent reply other threads:[~2018-02-05 15:16 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-30 8:36 Salvador Fandino
2018-01-30 8:36 ` [PATCH 1/4] " Salvador Fandino
2018-01-30 8:36 ` [PATCH 2/4] libusbip: use per vhci_hcd controller attributes Salvador Fandino
2018-01-30 8:36 ` [PATCH 3/4] usbip tools: " Salvador Fandino
2018-01-30 8:36 ` [PATCH 4/4] config: make USB_MAXBUS configurable and adjust VHCI_NR_HCS top limit Salvador Fandino
2018-02-05 15:16 ` Shuah Khan [this message]
2018-02-21 0:35 ` [PATH 0/4] usbip: make vhci_hcd.* objects independent of vhci_hcd.0 Shuah Khan
2018-03-05 9:00 ` Salvador Fandiño
2018-03-06 0:03 ` Shuah Khan
2018-03-06 8:35 ` Salvador Fandiño
2018-03-06 20:58 ` Shuah Khan
2018-03-08 12:45 ` Salvador Fandiño
2018-09-24 7:17 ` Salvador Fandino
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=de022e9c-c42b-9af9-b118-6f7de336dc66@kernel.org \
--to=shuah@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=salva@qindel.com \
--cc=shuahkh@osg.samsung.com \
--cc=valentina.manea.m@gmail.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
all inboxes | Powered by JetHome®