Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-20 Thread Andy Lutomirski
On Sep 19, 2014 2:33 PM, Benjamin Herrenschmidt b...@kernel.crashing.org wrote: On Wed, 2014-09-17 at 09:07 -0700, Andy Lutomirski wrote: It shouldn't. That being said, at some point this problem will need solving on PPC, and this patch doesn't help much, other than adding the virtio_ring

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-20 Thread Andy Lutomirski
Cheers, Ben. -- Andy Lutomirski AMA Capital Management, LLC ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-19 Thread Andy Lutomirski
On Sep 19, 2014 9:40 AM, H. Peter Anvin h...@zytor.com wrote: On 09/19/2014 09:14 AM, Nakajima, Jun wrote: I slept on it, and I think using the CPUID instruction alone would be simple and efficient: - We have a huge space for CPUID leaves - CPUID also works for user-level - It can

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-19 Thread Andy Lutomirski
On Sep 19, 2014 9:53 AM, Gleb Natapov g...@kernel.org wrote: On Fri, Sep 19, 2014 at 09:40:07AM -0700, H. Peter Anvin wrote: On 09/19/2014 09:37 AM, Gleb Natapov wrote: Linux detects what hypervior it runs on very early Not anywhere close to early enough. We're talking for uses like

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-19 Thread Andy Lutomirski
On Fri, Sep 19, 2014 at 10:36 AM, H. Peter Anvin h...@zytor.com wrote: On 09/19/2014 10:21 AM, Andy Lutomirski wrote: There is a huge disadvantage to the fact that CPUID is a user space instruction, though. We can always make cpuid on the leaf in question return all zeros if CPL 0

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-19 Thread Andy Lutomirski
On Fri, Sep 19, 2014 at 10:49 AM, Gleb Natapov g...@kernel.org wrote: On Fri, Sep 19, 2014 at 10:18:37AM -0700, H. Peter Anvin wrote: On 09/19/2014 10:15 AM, Gleb Natapov wrote: On Fri, Sep 19, 2014 at 10:08:20AM -0700, H. Peter Anvin wrote: On 09/19/2014 09:53 AM, Gleb Natapov wrote: On

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-19 Thread Andy Lutomirski
[cc: Alok Kataria at VMware] On Fri, Sep 19, 2014 at 11:12 AM, Gleb Natapov g...@kernel.org wrote: On Fri, Sep 19, 2014 at 11:02:38AM -0700, Andy Lutomirski wrote: On Fri, Sep 19, 2014 at 10:49 AM, Gleb Natapov g...@kernel.org wrote: On Fri, Sep 19, 2014 at 10:18:37AM -0700, H. Peter Anvin

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-19 Thread Andy Lutomirski
On Fri, Sep 19, 2014 at 11:30 AM, Christopher Covington c...@codeaurora.org wrote: On 09/17/2014 10:50 PM, Andy Lutomirski wrote: Hi all- I would like to standardize on a very simple protocol by which a guest OS can obtain an RNG seed early in boot. The main design requirements

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-19 Thread Andy Lutomirski
On Fri, Sep 19, 2014 at 1:21 PM, Nadav Amit nadav.a...@gmail.com wrote: On Sep 19, 2014, at 9:42 PM, Andy Lutomirski l...@amacapital.net wrote: On Fri, Sep 19, 2014 at 11:30 AM, Christopher Covington c...@codeaurora.org wrote: On 09/17/2014 10:50 PM, Andy Lutomirski wrote: Hi all- I would

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-19 Thread Andy Lutomirski
On Fri, Sep 19, 2014 at 3:05 PM, Theodore Ts'o ty...@mit.edu wrote: On Fri, Sep 19, 2014 at 09:40:42AM -0700, H. Peter Anvin wrote: There is a huge disadvantage to the fact that CPUID is a user space instruction, though. But if the goal is to provide something like getrandom(2) direct from

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-19 Thread Andy Lutomirski
On Fri, Sep 19, 2014 at 3:57 PM, Theodore Ts'o ty...@mit.edu wrote: On Fri, Sep 19, 2014 at 03:06:55PM -0700, Andy Lutomirski wrote: On Fri, Sep 19, 2014 at 3:05 PM, Theodore Ts'o ty...@mit.edu wrote: On Fri, Sep 19, 2014 at 09:40:42AM -0700, H. Peter Anvin wrote: There is a huge

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-19 Thread Andy Lutomirski
On Fri, Sep 19, 2014 at 4:35 PM, Theodore Ts'o ty...@mit.edu wrote: On Fri, Sep 19, 2014 at 04:29:53PM -0700, H. Peter Anvin wrote: Actually, a much bigger reason is because it lets rogue guest *user space*, even will a well-behaved guest OS, do something potentially harmful to the host.

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-18 Thread Andy Lutomirski
probably need something new. --Andy -hpa -- Andy Lutomirski AMA Capital Management, LLC ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-18 Thread Andy Lutomirski
On Thu, Sep 18, 2014 at 8:38 AM, Andy Lutomirski l...@amacapital.net wrote: On Thu, Sep 18, 2014 at 7:43 AM, H. Peter Anvin h...@zytor.com wrote: On 09/18/2014 07:40 AM, KY Srinivasan wrote: The main questions are what MSR index to use and how to detect the presence of the MSR. I've played

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-18 Thread Andy Lutomirski
, 2014 10:18 AM To: Nakajima, Jun; KY Srinivasan Cc: Mathew John; Theodore Ts'o; John Starks; kvm list; Gleb Natapov; Niels Ferguson; Andy Lutomirski; David Hepkin; H. Peter Anvin; Jake Oshins; Linux Virtualization Subject: Re: Standardizing an MSR or other hypercall to get an RNG seed? Il 18/09

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-18 Thread Andy Lutomirski
On Thu, Sep 18, 2014 at 11:54 AM, Niels Ferguson ni...@microsoft.com wrote: Defining a standard way of transferring random numbers between the host and the guest is an excellent idea. As the person who writes the RNG code in Windows, I have a few comments: DETECTION: It should be possible

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-18 Thread Andy Lutomirski
On Thu, Sep 18, 2014 at 11:58 AM, Paolo Bonzini pbonz...@redhat.com wrote: Actually, that MSR address range has been reserved for that purpose, along with: - CPUID.EAX=1 - ECX bit 31 (always returns 0 on bare metal) - CPUID.EAX=4000_00xxH leaves (i.e. HYPERVISOR CPUID) I don't know

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-18 Thread Andy Lutomirski
On Thu, Sep 18, 2014 at 2:21 PM, Nakajima, Jun jun.nakaj...@intel.com wrote: On Thu, Sep 18, 2014 at 12:07 PM, Andy Lutomirski l...@amacapital.net wrote: Might Intel be willing to extend that range to 0x4000 - 0x400f? And would Microsoft be okay with using this mechanism

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-18 Thread Andy Lutomirski
On Thu, Sep 18, 2014 at 2:46 PM, David Hepkin david...@microsoft.com wrote: I'm not sure what you mean by this mechanism? Are you suggesting that each hypervisor put CrossHVPara\0 somewhere in the 0x4000 - 0x400f CPUID range, and an OS has to do a full scan of this CPUID range on

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-18 Thread Andy Lutomirski
On Thu, Sep 18, 2014 at 2:57 PM, H. Peter Anvin h...@zytor.com wrote: On 09/18/2014 02:46 PM, David Hepkin wrote: I'm not sure what you mean by this mechanism? Are you suggesting that each hypervisor put CrossHVPara\0 somewhere in the 0x4000 - 0x400f CPUID range, and an OS has to do

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-18 Thread Andy Lutomirski
On Thu, Sep 18, 2014 at 5:49 PM, Nakajima, Jun jun.nakaj...@intel.com wrote: On Thu, Sep 18, 2014 at 3:07 PM, Andy Lutomirski l...@amacapital.net wrote: So, as a concrete straw-man: CPUID leaf 0x4800 would return a maximum leaf number in EAX (e.g. 0x4801) along with a signature value

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-18 Thread Andy Lutomirski
On Thu, Sep 18, 2014 at 6:03 PM, Andy Lutomirski l...@amacapital.net wrote: On Thu, Sep 18, 2014 at 5:49 PM, Nakajima, Jun jun.nakaj...@intel.com wrote: On Thu, Sep 18, 2014 at 3:07 PM, Andy Lutomirski l...@amacapital.net wrote: So, as a concrete straw-man: CPUID leaf 0x4800 would return

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-17 Thread Andy Lutomirski
On Sep 17, 2014 7:13 AM, Michael S. Tsirkin m...@redhat.com wrote: On Wed, Sep 17, 2014 at 08:02:31AM -0400, Benjamin Herrenschmidt wrote: On Tue, 2014-09-16 at 22:22 -0700, Andy Lutomirski wrote: On non-PPC systems, virtio_pci should use the DMA API. This fixes virtio_pci on Xen

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-17 Thread Andy Lutomirski
On Wed, Sep 17, 2014 at 9:09 AM, Ira W. Snyder i...@ovro.caltech.edu wrote: On Tue, Sep 16, 2014 at 10:22:27PM -0700, Andy Lutomirski wrote: On non-PPC systems, virtio_pci should use the DMA API. This fixes virtio_pci on Xen. On PPC, using the DMA API would break things, so we need

Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-17 Thread Andy Lutomirski
mechanism. If we do the latter, I don't know what that mechanism would be. NB: This thread will be cc'd to Microsoft and possibly Hyper-V people shortly. I very much appreciate Jun Nakajima's help with this! Thanks, Andy -- Andy Lutomirski AMA Capital Management, LLC

[PATCH v5 1/3] virtio_ring: Support DMA APIs if requested

2014-09-16 Thread Andy Lutomirski
kmemleak and CONFIG_DMA_API_DEBUG. virtio-net warns (correctly) about DMA from the stack in virtnet_set_rx_mode. This explicitly supports !CONFIG_HAS_DMA. If vring is asked to use the DMA API and CONFIG_HAS_DMA is not set, then vring will refuse to create the virtqueue. Signed-off-by: Andy

[PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-16 Thread Andy Lutomirski
On non-PPC systems, virtio_pci should use the DMA API. This fixes virtio_pci on Xen. On PPC, using the DMA API would break things, so we need to preserve the old behavior. The big comment in this patch explains the considerations in more detail. Signed-off-by: Andy Lutomirski l

[PATCH v5 0/3] virtio: Use the DMA API when appropriate

2014-09-16 Thread Andy Lutomirski
is optional now. It would be nice to improve the DMA API to the point that it could be used unconditionally, but s390 proves that we're not there yet. - Includes patch 4, which fixes DMA debugging warnings from virtio_net. Andy Lutomirski (3): virtio_ring: Support DMA APIs if requested

[PATCH v5 3/3] virtio_net: Stop doing DMA from the stack

2014-09-16 Thread Andy Lutomirski
Now that virtio supports real DMA, drivers should play by the rules. For virtio_net, that means that DMA should be done to and from dynamically-allocated memory, not the kernel stack. This should have no effect on any performance-critical code paths. Signed-off-by: Andy Lutomirski l

Re: [PATCH v4 0/4] virtio: Clean up scatterlists and use the DMA API

2014-09-10 Thread Andy Lutomirski
On Wed, Sep 10, 2014 at 8:36 AM, Christopher Covington c...@codeaurora.org wrote: On 09/04/2014 10:57 PM, Andy Lutomirski wrote: There's a third option: try to make virtio-mmio work everywhere (except s390), at least in the long run. This other benefits: it makes minimal hypervisors simpler

Re: [PATCH 3/3] virtio_ring: unify direct/indirect code paths.

2014-09-08 Thread Andy Lutomirski
On Sep 5, 2014 3:55 AM, Paolo Bonzini pbonz...@redhat.com wrote: Il 03/09/2014 06:29, Rusty Russell ha scritto: + desc = kmalloc(total_sg * sizeof(struct vring_desc), gfp); + if (!desc) + return NULL; - return head; + for (i = 0; i total_sg; i++) +

Re: [PATCH v4 0/4] virtio: Clean up scatterlists and use the DMA API

2014-09-04 Thread Andy Lutomirski
On Thu, Sep 4, 2014 at 7:31 PM, Rusty Russell ru...@rustcorp.com.au wrote: Andy Lutomirski l...@amacapital.net writes: On Sep 2, 2014 11:53 PM, Rusty Russell ru...@rustcorp.com.au wrote: Andy Lutomirski l...@amacapital.net writes: There really are virtio devices that are pieces of silicon

Re: [PATCH v4 0/4] virtio: Clean up scatterlists and use the DMA API

2014-09-04 Thread Andy Lutomirski
On Thu, Sep 4, 2014 at 7:32 PM, Rusty Russell ru...@rustcorp.com.au wrote: Michael S. Tsirkin m...@redhat.com writes: On Wed, Sep 03, 2014 at 04:12:01PM +0930, Rusty Russell wrote: Andy Lutomirski l...@amacapital.net writes: There really are virtio devices that are pieces of silicon

Re: [PATCH v4 0/4] virtio: Clean up scatterlists and use the DMA API

2014-09-03 Thread Andy Lutomirski
On Sep 2, 2014 11:53 PM, Rusty Russell ru...@rustcorp.com.au wrote: Andy Lutomirski l...@amacapital.net writes: There really are virtio devices that are pieces of silicon and not figments of a hypervisor's imagination [1]. Hi Andy, As you're discovering, there's a reason no one

Re: [PATCH v4 0/4] virtio: Clean up scatterlists and use the DMA API

2014-09-03 Thread Andy Lutomirski
On Wed, Sep 3, 2014 at 12:47 AM, Paolo Bonzini pbonz...@redhat.com wrote: Il 03/09/2014 02:25, Benjamin Herrenschmidt ha scritto: But there aren't any ACPI systems with both virtio-pci and IOMMUs, right? So we could say that, henceforth, ACPI systems must declare whether virtio-pci devices

Re: [PATCH v4 0/4] virtio: Clean up scatterlists and use the DMA API

2014-09-03 Thread Andy Lutomirski
On Sep 3, 2014 5:11 AM, Paolo Bonzini pbonz...@redhat.com wrote: Il 03/09/2014 10:05, Benjamin Herrenschmidt ha scritto: On Wed, 2014-09-03 at 09:47 +0200, Paolo Bonzini wrote: IOMMU support for x86 is going to go in this week. But won't that break virtio on x86 ? Or will virtio

Re: [PATCH v4 0/4] virtio: Clean up scatterlists and use the DMA API

2014-09-03 Thread Andy Lutomirski
On Wed, Sep 3, 2014 at 9:39 AM, Michael S. Tsirkin m...@redhat.com wrote: On Wed, Sep 03, 2014 at 08:07:15AM -0700, Andy Lutomirski wrote: On Sep 3, 2014 5:11 AM, Paolo Bonzini pbonz...@redhat.com wrote: Il 03/09/2014 10:05, Benjamin Herrenschmidt ha scritto: On Wed, 2014-09-03 at 09:47

Re: [PATCH 3/3] virtio_ring: unify direct/indirect code paths.

2014-09-03 Thread Andy Lutomirski
On Tue, Sep 2, 2014 at 9:29 PM, Rusty Russell ru...@rustcorp.com.au wrote: virtqueue_add() populates the virtqueue descriptor table from the sgs given. If it uses an indirect descriptor table, then it puts a single descriptor in the descriptor table pointing to the kmalloc'ed indirect table

Re: [PATCH v4 0/4] virtio: Clean up scatterlists and use the DMA API

2014-09-03 Thread Andy Lutomirski
On Tue, Sep 2, 2014 at 5:43 PM, Benjamin Herrenschmidt b...@au1.ibm.com wrote: On Tue, 2014-09-02 at 17:32 -0700, Andy Lutomirski wrote: I agree *except* that implementing it will be a real PITA and (I think) can't be done without changing code in arch/. My patches plus an ifdef powerpc

Re: [PATCH v4 0/4] virtio: Clean up scatterlists and use the DMA API

2014-09-02 Thread Andy Lutomirski
On Tue, Sep 2, 2014 at 1:53 PM, Benjamin Herrenschmidt b...@kernel.crashing.org wrote: On Mon, 2014-09-01 at 22:55 -0700, Andy Lutomirski wrote: On x86, at least, I doubt that we'll ever see a physically addressed PCI virtio device for which ACPI advertises an IOMMU, since any sane hypervisor

Re: [PATCH v4 0/4] virtio: Clean up scatterlists and use the DMA API

2014-09-02 Thread Andy Lutomirski
On Tue, Sep 2, 2014 at 2:10 PM, Michael S. Tsirkin m...@redhat.com wrote: On Mon, Sep 01, 2014 at 10:55:29PM -0700, Andy Lutomirski wrote: On Mon, Sep 1, 2014 at 3:16 PM, Benjamin Herrenschmidt b...@kernel.crashing.org wrote: On Mon, 2014-09-01 at 10:39 -0700, Andy Lutomirski wrote: Changes

Re: [PATCH v4 0/4] virtio: Clean up scatterlists and use the DMA API

2014-09-02 Thread Andy Lutomirski
On Tue, Sep 2, 2014 at 3:10 PM, Benjamin Herrenschmidt b...@kernel.crashing.org wrote: On Tue, 2014-09-02 at 14:37 -0700, Andy Lutomirski wrote: Let's take a step back from from the implementation. What is a driver for a virtio PCI device (i.e. a PCI device with vendor 0x1af4) supposed to do

Re: [PATCH v4 0/4] virtio: Clean up scatterlists and use the DMA API

2014-09-02 Thread Andy Lutomirski
On Tue, Sep 2, 2014 at 4:20 PM, Benjamin Herrenschmidt b...@au1.ibm.com wrote: On Tue, 2014-09-02 at 16:11 -0700, Andy Lutomirski wrote: I don't think so. I would argue that it's a straight-up bug for QEMU to expose a physically-addressed virtio-pci device to the guest behind an emulated

Re: [PATCH v4 0/4] virtio: Clean up scatterlists and use the DMA API

2014-09-02 Thread Andy Lutomirski
On Tue, Sep 2, 2014 at 5:25 PM, Benjamin Herrenschmidt b...@au1.ibm.com wrote: On Tue, 2014-09-02 at 16:42 -0700, Andy Lutomirski wrote: So here's an ugly proposal: Step 1: Make virtio-pci use the DMA API only on x86. This will at least fix Xen and people experimenting with virtio hardware

Re: [PATCH 1/3] virtio_net: pass well-formed sgs to virtqueue_add_*()

2014-09-02 Thread Andy Lutomirski
On Tue, Sep 2, 2014 at 9:29 PM, Rusty Russell ru...@rustcorp.com.au wrote: This is the only driver which doesn't hand virtqueue_add_inbuf and virtqueue_add_outbuf a well-formed, well-terminated sg. Fix it, so we can make virtio_add_* simpler. OK, I get it now: you're reinitializing the table

Re: [PATCH 1/3] virtio_ring: Remove sg_next indirection

2014-09-01 Thread Andy Lutomirski
On Sep 1, 2014 12:00 AM, Michael S. Tsirkin m...@redhat.com wrote: On Sun, Aug 31, 2014 at 06:42:38PM -0700, Andy Lutomirski wrote: On Sun, Aug 31, 2014 at 5:58 PM, Rusty Russell ru...@rustcorp.com.au wrote: Andy Lutomirski l...@amacapital.net writes: The only unusual thing about

[PATCH v4 1/4] virtio_ring: Support DMA APIs if requested

2014-09-01 Thread Andy Lutomirski
kmemleak and CONFIG_DMA_API_DEBUG. virtio-net warns (correctly) about DMA from the stack in virtnet_set_rx_mode. This explicitly supports !CONFIG_HAS_DMA. If vring is asked to use the DMA API and CONFIG_HAS_DMA is not set, then vring will refuse to create the virtqueue. Signed-off-by: Andy

[PATCH v4 2/4] virtio_pci: Use the DMA API for virtqueues

2014-09-01 Thread Andy Lutomirski
can be removed. Signed-off-by: Andy Lutomirski l...@amacapital.net --- drivers/virtio/virtio_pci.c | 40 +++- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index a1f299fa4626

[PATCH v4 3/4] virtio_net: Don't set the end flag on reusable sg entries

2014-09-01 Thread Andy Lutomirski
, this will blow up. Signed-off-by: Andy Lutomirski l...@amacapital.net --- drivers/net/virtio_net.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 59caa06f34a6..c90466a4fab0 100644 --- a/drivers/net/virtio_net.c +++ b

[PATCH v4 0/4] virtio: Clean up scatterlists and use the DMA API

2014-09-01 Thread Andy Lutomirski
patch 4, which fixes DMA debugging warnings from virtio_net. Andy Lutomirski (4): virtio_ring: Support DMA APIs if requested virtio_pci: Use the DMA API for virtqueues virtio_net: Don't set the end flag on reusable sg entries virtio_net: Stop doing DMA from the stack drivers/lguest

[PATCH v4 4/4] virtio_net: Stop doing DMA from the stack

2014-09-01 Thread Andy Lutomirski
Now that virtio supports real DMA, drivers should play by the rules. For virtio_net, that means that DMA should be done to and from dynamically-allocated memory, not the kernel stack. This should have no effect on any performance-critical code paths. Signed-off-by: Andy Lutomirski l

Re: [PATCH v4 0/4] virtio: Clean up scatterlists and use the DMA API

2014-09-01 Thread Andy Lutomirski
On Mon, Sep 1, 2014 at 3:16 PM, Benjamin Herrenschmidt b...@kernel.crashing.org wrote: On Mon, 2014-09-01 at 10:39 -0700, Andy Lutomirski wrote: Changes from v1: - Using the DMA API is optional now. It would be nice to improve the DMA API to the point that it could be used unconditionally

Re: [PATCH 1/3] virtio_ring: Remove sg_next indirection

2014-08-31 Thread Andy Lutomirski
On Sun, Aug 31, 2014 at 5:58 PM, Rusty Russell ru...@rustcorp.com.au wrote: Andy Lutomirski l...@amacapital.net writes: The only unusual thing about virtio's use of scatterlists is that two of the APIs accept scatterlists that might not be terminated. Using function pointers to handle

Re: GET_RNG_SEED hypercall ABI? (Re: [PATCH v5 0/5] random,x86,kvm: Rework arch RNG seeds and get some from kvm)

2014-08-28 Thread Andy Lutomirski
On Aug 28, 2014 7:17 AM, Gleb Natapov g...@kernel.org wrote: On Tue, Aug 26, 2014 at 04:58:34PM -0700, Andy Lutomirski wrote: hpa pointed out that the ABI that I chose (an MSR from the KVM range and a KVM cpuid bit) is unnecessarily KVM-specific. It would be nice to allocate an MSR

Re: [PATCH v2 0/4] virtio: Clean up scatterlists and use the DMA API

2014-08-28 Thread Andy Lutomirski
On Thu, Aug 28, 2014 at 12:44 AM, Christian Borntraeger borntrae...@de.ibm.com wrote: On 27/08/14 23:50, Andy Lutomirski wrote: This fixes virtio on Xen guests as well as on any other platform that uses virtio_pci on which physical addresses don't match bus addresses. This can be tested

Re: [PATCH v2 0/4] virtio: Clean up scatterlists and use the DMA API

2014-08-28 Thread Andy Lutomirski
On Thu, Aug 28, 2014 at 11:29 AM, Christian Borntraeger borntrae...@de.ibm.com wrote: On 28/08/14 20:06, Andy Lutomirski wrote: [...] block seems to work, with net a simple ping works, iperf causes this: I neither see the bug, nor can I reproduce it on x86_64 on KVM. I doubt that dma vs

Re: [virtio-dev] Re: [PATCH v2 0/4] virtio: Clean up scatterlists and use the DMA API

2014-08-28 Thread Andy Lutomirski
[removed virtio-dev -- I'm sick of bounces] On Thu, Aug 28, 2014 at 11:55 AM, Paolo Bonzini pbonz...@redhat.com wrote: Il 28/08/2014 20:29, Christian Borntraeger ha scritto: block seems to work, with net a simple ping works, iperf causes this: I neither see the bug, nor can I reproduce it

Re: [virtio-dev] Re: [PATCH v2 0/4] virtio: Clean up scatterlists and use the DMA API

2014-08-28 Thread Andy Lutomirski
On Thu, Aug 28, 2014 at 12:18 PM, Christian Borntraeger borntrae...@de.ibm.com wrote: On 28/08/14 21:03, Andy Lutomirski wrote: [removed virtio-dev -- I'm sick of bounces] On Thu, Aug 28, 2014 at 11:55 AM, Paolo Bonzini pbonz...@redhat.com wrote: Il 28/08/2014 20:29, Christian Borntraeger ha

[PATCH v3 0/5] virtio: Clean up scatterlists and use the DMA API

2014-08-28 Thread Andy Lutomirski
to improve the DMA API to the point that it could be used unconditionally, but s390 proves that we're not there yet. - Includes patch 4, which fixes DMA debugging warnings from virtio_net. Andy Lutomirski (5): virtio_ring: Support DMA APIs if requested virtio_pci: Use the DMA API

[PATCH v3 4/5] virtio_net: Don't set the end flag on reusable sg entries

2014-08-28 Thread Andy Lutomirski
, this will blow up. Signed-off-by: Andy Lutomirski l...@amacapital.net --- drivers/net/virtio_net.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 960a2172b07a..25703fd2df28 100644 --- a/drivers/net/virtio_net.c +++ b

[PATCH v3 2/5] virtio_pci: Use the DMA API for virtqueues

2014-08-28 Thread Andy Lutomirski
A virtqueue is a coherent DMA mapping. Use the DMA API for it. This fixes virtio_pci on Xen. Signed-off-by: Andy Lutomirski l...@amacapital.net --- drivers/virtio/virtio_pci.c | 34 +- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/drivers/virtio

[PATCH v3 1/5] virtio_ring: Support DMA APIs if requested

2014-08-28 Thread Andy Lutomirski
kmemleak and CONFIG_DMA_API_DEBUG. virtio-net warns (correctly) about DMA from the stack in virtnet_set_rx_mode. This explicitly supports !CONFIG_HAS_DMA. If vring is asked to use the DMA API and CONFIG_HAS_DMA is not set, then vring will refuse to create the virtqueue. Signed-off-by: Andy

Re: GET_RNG_SEED hypercall ABI? (Re: [PATCH v5 0/5] random,x86,kvm: Rework arch RNG seeds and get some from kvm)

2014-08-28 Thread Andy Lutomirski
On Thu, Aug 28, 2014 at 12:46 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 28/08/2014 18:22, Andy Lutomirski ha scritto: Is there a non-cpuid interface between QEMU and KVM for this? No. Hmm. Then, assuming that someone manages to allocate a cross-hypervisor MSR number for this, what am I

Re: virtio DMA API?

2014-08-27 Thread Andy Lutomirski
On Aug 27, 2014 4:30 AM, Rusty Russell ru...@rustcorp.com.au wrote: Andy Lutomirski l...@amacapital.net writes: Currently, a lot of the virtio code assumes that bus (i.e. hypervisor) addresses are the same as physical address. This is false on Xen, so virtio is completely broken. I

Re: [PATCH 0/3] virtio: Clean up scatterlists and use the DMA API

2014-08-27 Thread Andy Lutomirski
On Aug 26, 2014 11:46 PM, Stefan Hajnoczi stefa...@gmail.com wrote: On Tue, Aug 26, 2014 at 10:16 PM, Andy Lutomirski l...@amacapital.net wrote: There are two outstanding issues. virtio_net warns if DMA debugging is on because it does DMA from the stack. (The warning is correct

Re: [PATCH 0/3] virtio: Clean up scatterlists and use the DMA API

2014-08-27 Thread Andy Lutomirski
On Wed, Aug 27, 2014 at 8:45 AM, Michael S. Tsirkin m...@redhat.com wrote: On Wed, Aug 27, 2014 at 08:11:15AM -0700, Andy Lutomirski wrote: On Aug 26, 2014 11:46 PM, Stefan Hajnoczi stefa...@gmail.com wrote: On Tue, Aug 26, 2014 at 10:16 PM, Andy Lutomirski l...@amacapital.net wrote

Re: [PATCH 0/3] virtio: Clean up scatterlists and use the DMA API

2014-08-27 Thread Andy Lutomirski
On Wed, Aug 27, 2014 at 9:13 AM, Christopher Covington c...@codeaurora.org wrote: On 08/27/2014 11:50 AM, Andy Lutomirski wrote: On Wed, Aug 27, 2014 at 8:45 AM, Michael S. Tsirkin m...@redhat.com wrote: On Wed, Aug 27, 2014 at 08:11:15AM -0700, Andy Lutomirski wrote: On Aug 26, 2014 11:46 PM

Re: [PATCH 3/3] virtio_pci: Use the DMA API for virtqueues

2014-08-27 Thread Andy Lutomirski
On Wed, Aug 27, 2014 at 10:32 AM, Konrad Rzeszutek Wilk konrad.w...@oracle.com wrote: On Tue, Aug 26, 2014 at 02:17:02PM -0700, Andy Lutomirski wrote: A virtqueue is a coherent DMA mapping. Use the DMA API for it. This fixes virtio_pci on Xen. Signed-off-by: Andy Lutomirski l

Re: [PATCH 0/3] virtio: Clean up scatterlists and use the DMA API

2014-08-27 Thread Andy Lutomirski
On Wed, Aug 27, 2014 at 10:34 AM, Christopher Covington c...@codeaurora.org wrote: On 08/27/2014 12:19 PM, Andy Lutomirski wrote: On Wed, Aug 27, 2014 at 9:13 AM, Christopher Covington c...@codeaurora.org wrote: Virtme looks interesting. If it's any use, here is my modest QEMU command line

Re: [PATCH 2/3] virtio_ring: Use DMA APIs

2014-08-27 Thread Andy Lutomirski
On Wed, Aug 27, 2014 at 10:35 AM, Konrad Rzeszutek Wilk konrad.w...@oracle.com wrote: On Wed, Aug 27, 2014 at 09:29:36AM +0200, Christian Borntraeger wrote: On 26/08/14 23:17, Andy Lutomirski wrote: virtio_ring currently sends the device (usually a hypervisor) physical addresses of its I/O

[PATCH v2 0/4] virtio: Clean up scatterlists and use the DMA API

2014-08-27 Thread Andy Lutomirski
be nice to improve the DMA API to the point that it could be used unconditionally, but s390 proves that we're not there yet. - Includes patch 4, which fixes DMA debugging warnings from virtio_net. Andy Lutomirski (4): virtio_ring: Remove sg_next indirection virtio_ring: Support DMA APIs

[PATCH v2 1/4] virtio_ring: Remove sg_next indirection

2014-08-27 Thread Andy Lutomirski
, but, because of the way that virtio_ring handles multiple scatterlists at once, the count is only an upper bound if there is more than one scatterlist. This is easily solved by checking the sg pointer for NULL on each iteration. Signed-off-by: Andy Lutomirski l...@amacapital.net --- drivers

[PATCH v2 2/4] virtio_ring: Support DMA APIs if requested

2014-08-27 Thread Andy Lutomirski
kmemleak and CONFIG_DMA_API_DEBUG. virtio-net warns (correctly) about DMA from the stack in virtnet_set_rx_mode. This explicitly supports !CONFIG_HAS_DMA. If vring is asked to use the DMA API and CONFIG_HAS_DMA is not set, then vring will refuse to create the virtqueue. Signed-off-by: Andy

[PATCH v2 4/4] virtio_net: Stop doing DMA from the stack

2014-08-27 Thread Andy Lutomirski
Now that virtio supports real DMA, drivers should play by the rules. For virtio_net, that means that DMA should be done to and from dynamically-allocated memory, not the kernel stack. This should have no effect on any performance-critical code paths. Signed-off-by: Andy Lutomirski l

[PATCH v2 3/4] virtio_pci: Use the DMA API for virtqueues

2014-08-27 Thread Andy Lutomirski
A virtqueue is a coherent DMA mapping. Use the DMA API for it. This fixes virtio_pci on Xen. Signed-off-by: Andy Lutomirski l...@amacapital.net --- drivers/virtio/virtio_pci.c | 34 +- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/drivers/virtio

[PATCH 0/3] virtio: Clean up scatterlists and use the DMA API

2014-08-26 Thread Andy Lutomirski
are cc'd -- I don't know what to do about it.) Andy Lutomirski (3): virtio_ring: Remove sg_next indirection virtio_ring: Use DMA APIs virtio_pci: Use the DMA API for virtqueues drivers/virtio/Kconfig | 1 + drivers/virtio/virtio_pci.c | 25 ++-- drivers/virtio/virtio_ring.c

[PATCH 3/3] virtio_pci: Use the DMA API for virtqueues

2014-08-26 Thread Andy Lutomirski
A virtqueue is a coherent DMA mapping. Use the DMA API for it. This fixes virtio_pci on Xen. Signed-off-by: Andy Lutomirski l...@amacapital.net --- drivers/virtio/virtio_pci.c | 25 ++--- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/drivers/virtio

[PATCH 2/3] virtio_ring: Use DMA APIs

2014-08-26 Thread Andy Lutomirski
through a PCI IOMMU, which is presumably not the case for virtio. Cc: Cornelia Huck cornelia.h...@de.ibm.com Signed-off-by: Andy Lutomirski l...@amacapital.net --- drivers/virtio/Kconfig | 1 + drivers/virtio/virtio_ring.c | 116 +++ 2 files changed

[PATCH 1/3] virtio_ring: Remove sg_next indirection

2014-08-26 Thread Andy Lutomirski
, but, because of the way that virtio_ring handles multiple scatterlists at once, the count is only an upper bound if there is more than one scatterlist. This is easily solved by checking the sg pointer for NULL on each iteration. Signed-off-by: Andy Lutomirski l...@amacapital.net --- drivers

GET_RNG_SEED hypercall ABI? (Re: [PATCH v5 0/5] random,x86,kvm: Rework arch RNG seeds and get some from kvm)

2014-08-26 Thread Andy Lutomirski
hpa pointed out that the ABI that I chose (an MSR from the KVM range and a KVM cpuid bit) is unnecessarily KVM-specific. It would be nice to allocate an MSR that everyone involved can agree on and, rather than relying on a cpuid bit, just have the guest probe for the MSR. This leads to a few

virtio DMA API?

2014-08-25 Thread Andy Lutomirski
address is enough to call kfree, and I don't think that the DMA API provides a reverse mapping like that. --Andy -- Andy Lutomirski AMA Capital Management, LLC ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https

Re: virtio DMA API?

2014-08-25 Thread Andy Lutomirski
On Mon, Aug 25, 2014 at 11:54 AM, Konrad Rzeszutek Wilk konrad.w...@oracle.com wrote: On Mon, Aug 25, 2014 at 10:18:46AM -0700, Andy Lutomirski wrote: Currently, a lot of the virtio code assumes that bus (i.e. hypervisor) addresses are the same as physical address. This is false on Xen, so

OOPS in hvc / virtconsole

2014-03-31 Thread Andy Lutomirski
I'm running a Fedora distro kernel (3.13.7-200.fc20.x86_64) in kvm with these options: -chardev null,id=hvc0,signal=off -device virtio-serial-pci -device virtconsole,chardev=hvc0,name=virtme_console -append console=hvc0 console=ttyS0 -nographic (There are more, but these are the interesting

Re: OOPS in hvc / virtconsole

2014-03-31 Thread Andy Lutomirski
On Mon, Mar 31, 2014 at 3:31 PM, Andy Lutomirski l...@amacapital.net wrote: I'm running a Fedora distro kernel (3.13.7-200.fc20.x86_64) in kvm with these options: -chardev null,id=hvc0,signal=off -device virtio-serial-pci -device virtconsole,chardev=hvc0,name=virtme_console -append console

[PATCH v2 0/6] Collected vdso/vsyscall fixes for 3.1

2011-08-03 Thread Andy Lutomirski
to handle performance regression reports :) [1] https://gitorious.org/linux-test-utils/linux-clock-tests Changes from v1: - Improve changelog message for x86-64/xen: Enable the vvar mapping - Fix 32-bit build. - Add patch 6. Andy Lutomirski (6): x86-64: Pad vDSO to a page boundary x86-64

[PATCH v2 2/6] x86-64: Move the user vsyscall segment out of the data segment.

2011-08-03 Thread Andy Lutomirski
The kernel's loader doesn't seem to care, but gold complains. Signed-off-by: Andy Lutomirski l...@mit.edu Reported-by: Arkadiusz Miskiewicz a.miskiew...@gmail.com --- arch/x86/kernel/vmlinux.lds.S | 36 ++-- 1 files changed, 18 insertions(+), 18 deletions

[PATCH v2 3/6] x86-64: Work around gold bug 13023

2011-08-03 Thread Andy Lutomirski
of doing it. This produces an apparently valid kernel image and passes my vdso tests on both GNU ld version 2.21.51.0.6-2.fc15 20110118 and GNU gold (version 2.21.51.0.6-2.fc15 20110118) 1.10 as distributed by Fedora 15. Signed-off-by: Andy Lutomirski l...@mit.edu Reported-by: Arkadiusz Miskiewicz

[PATCH v2 6/6] x86-64: Add vsyscall:emulate_vsyscall trace event

2011-08-03 Thread Andy Lutomirski
Vsyscall emulation is slow, so make it easy to track down. Signed-off-by: Andy Lutomirski l...@mit.edu --- arch/x86/kernel/vsyscall_64.c|6 ++ arch/x86/kernel/vsyscall_trace.h | 29 + 2 files changed, 35 insertions(+), 0 deletions(-) create mode 100644

[PATCH v2 4/6] x86-64/xen: Enable the vvar mapping

2011-08-03 Thread Andy Lutomirski
, pg_owner=10 (XEN) mm.c:5049:d10 ptwr_emulate: could not get_page_from_l1e() [0.00] BUG: unable to handle kernel NULL pointer dereference at (null) [0.00] IP: [8103a930] xen_set_pte+0x20/0xe0 Signed-off-by: Andy Lutomirski l...@mit.edu Reported-by: Konrad Rzeszutek Wilk

[PATCH v2 5/6] x86-64: Add user_64bit_mode paravirt op

2011-08-03 Thread Andy Lutomirski
a little ugly because ptrace.h can't include paravirt.h. Signed-off-by: Andy Lutomirski l...@mit.edu Reported-by: Konrad Rzeszutek Wilk konrad.w...@oracle.com --- arch/x86/include/asm/desc.h |4 ++-- arch/x86/include/asm/paravirt_types.h |6 ++ arch/x86/include/asm/ptrace.h

[PATCH v2 1/6] x86-64: Pad vDSO to a page boundary

2011-08-03 Thread Andy Lutomirski
This avoids an information leak to userspace. Signed-off-by: Andy Lutomirski l...@mit.edu --- arch/x86/vdso/vdso.S |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/arch/x86/vdso/vdso.S b/arch/x86/vdso/vdso.S index 1b979c1..01f5e3b 100644 --- a/arch/x86/vdso/vdso.S +++ b

[PATCH 0/5] Collected vdso/vsyscall fixes for 3.1

2011-07-26 Thread Andy Lutomirski
a usable Xen setup. Also, I'd appreciate a review of patches 4 and 5 from some Xen/paravirt people. [1] https://gitorious.org/linux-test-utils/linux-clock-tests Andy Lutomirski (5): x86-64: Pad vDSO to a page boundary x86-64: Move the user vsyscall segment out of the data segment. x86-64

[PATCH 3/5] x86-64: Work around gold bug 13023

2011-07-26 Thread Andy Lutomirski
of doing it. This produces an apparently valid kernel image and passes my vdso tests on both GNU ld version 2.21.51.0.6-2.fc15 20110118 and GNU gold (version 2.21.51.0.6-2.fc15 20110118) 1.10 as distributed by Fedora 15. Signed-off-by: Andy Lutomirski l...@mit.edu Reported-by: Arkadiusz Miskiewicz

[PATCH 4/5] x86-64/xen: Enable the vvar mapping

2011-07-26 Thread Andy Lutomirski
Xen needs special treatment for fixmaps. Signed-off-by: Andy Lutomirski l...@mit.edu Reported-by: Konrad Rzeszutek Wilk konrad.w...@oracle.com --- arch/x86/xen/mmu.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index f987bde

[PATCH 5/5] x86-64: Add user_64bit_mode paravirt op

2011-07-26 Thread Andy Lutomirski
a little ugly because ptrace.h can't include paravirt.h. Signed-off-by: Andy Lutomirski l...@mit.edu Reported-by: Konrad Rzeszutek Wilk konrad.w...@oracle.com --- arch/x86/include/asm/desc.h |4 ++-- arch/x86/include/asm/paravirt_types.h |6 ++ arch/x86/include/asm/ptrace.h

<    1   2   3