<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/virtio, branch v4.5</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v4.5</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.5'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2016-03-02T15:01:49Z</updated>
<entry>
<title>virtio-pci: read the right virtio_pci_notify_cap field</title>
<updated>2016-03-02T15:01:49Z</updated>
<author>
<name>Ladi Prosek</name>
<email>lprosek@redhat.com</email>
</author>
<published>2016-02-01T18:36:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4e94ebdd06d5dc72b7a40fc12fc496d601fb7bbc'/>
<id>urn:sha1:4e94ebdd06d5dc72b7a40fc12fc496d601fb7bbc</id>
<content type='text'>
Looks like a copy-paste bug. The value is used as an optimization and a
wrong value probably isn't causing any serious damage. Found when
porting this code to Windows.

Signed-off-by: Ladi Prosek &lt;lprosek@redhat.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;




</content>
</entry>
<entry>
<title>virtio_pci: fix use after free on release</title>
<updated>2016-01-26T08:18:28Z</updated>
<author>
<name>Michael S. Tsirkin</name>
<email>mst@redhat.com</email>
</author>
<published>2016-01-14T14:00:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2989be09a8a9d62a785137586ad941f916e08f83'/>
<id>urn:sha1:2989be09a8a9d62a785137586ad941f916e08f83</id>
<content type='text'>
KASan detected a use-after-free error in virtio-pci remove code. In
virtio_pci_remove(), vp_dev is still used after being freed in
unregister_virtio_device() (in virtio_pci_release_dev() more
precisely).

To fix, keep a reference until cleanup is done.

Fixes: 63bd62a08ca4 ("virtio_pci: defer kfree until release callback")
Reported-by: Jerome Marchand &lt;jmarchan@redhat.com&gt;
Cc: stable@vger.kernel.org
Cc: Sasha Levin &lt;sasha.levin@oracle.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Tested-by: Jerome Marchand &lt;jmarchan@redhat.com&gt;
</content>
</entry>
<entry>
<title>virtio: make find_vqs() checkpatch.pl-friendly</title>
<updated>2016-01-12T18:47:06Z</updated>
<author>
<name>Stefan Hajnoczi</name>
<email>stefanha@redhat.com</email>
</author>
<published>2015-12-17T08:53:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f7ad26ff952b3ca2702d7da03aad0ab1f6c01d7c'/>
<id>urn:sha1:f7ad26ff952b3ca2702d7da03aad0ab1f6c01d7c</id>
<content type='text'>
checkpatch.pl wants arrays of strings declared as follows:

  static const char * const names[] = { "vq-1", "vq-2", "vq-3" };

Currently the find_vqs() function takes a const char *names[] argument
so passing checkpatch.pl's const char * const names[] results in a
compiler error due to losing the second const.

This patch adjusts the find_vqs() prototype and updates all virtio
transports.  This makes it possible for virtio_balloon.c, virtio_input.c,
virtgpu_kms.c, and virtio_rpmsg_bus.c to use the checkpatch.pl-friendly
type.

Signed-off-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Acked-by: Bjorn Andersson &lt;bjorn.andersson@sonymobile.com&gt;
</content>
</entry>
<entry>
<title>virtio_balloon: fix race by fill and leak</title>
<updated>2016-01-12T18:47:05Z</updated>
<author>
<name>Minchan Kim</name>
<email>minchan@kernel.org</email>
</author>
<published>2015-12-27T23:35:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f68b992bbb474641881932c61c92dcfa6f5b3689'/>
<id>urn:sha1:f68b992bbb474641881932c61c92dcfa6f5b3689</id>
<content type='text'>
During my compaction-related stuff, I encountered a bug
with ballooning.

With repeated inflating and deflating cycle, guest memory(
ie, cat /proc/meminfo | grep MemTotal) is decreased and
couldn't be recovered.

The reason is balloon_lock doesn't cover release_pages_balloon
so struct virtio_balloon fields could be overwritten by race
of fill_balloon(e,g, vb-&gt;*pfns could be critical).

This patch fixes it in my test.

Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Minchan Kim &lt;minchan@kernel.org&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
<entry>
<title>virtio_ring: use virt_store_mb</title>
<updated>2016-01-12T18:47:02Z</updated>
<author>
<name>Michael S. Tsirkin</name>
<email>mst@redhat.com</email>
</author>
<published>2015-12-17T10:20:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=788e5b3a5da24cc8d93ce2f7c6508181cd7d7fb6'/>
<id>urn:sha1:788e5b3a5da24cc8d93ce2f7c6508181cd7d7fb6</id>
<content type='text'>
We need a full barrier after writing out event index, using
virt_store_mb there seems better than open-coding.  As usual, we need a
wrapper to account for strong barriers.

It's tempting to use this in vhost as well, for that, we'll
need a variant of smp_store_mb that works on __user pointers.

Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Acked-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
</content>
</entry>
<entry>
<title>virtio_ring: shadow available ring flags &amp; index</title>
<updated>2015-12-07T15:28:11Z</updated>
<author>
<name>Venkatesh Srinivas</name>
<email>venkateshs@google.com</email>
</author>
<published>2015-11-11T00:21:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f277ec42f38f406ed073569b24b04f1c291fec0f'/>
<id>urn:sha1:f277ec42f38f406ed073569b24b04f1c291fec0f</id>
<content type='text'>
Improves cacheline transfer flow of available ring header.

Virtqueues are implemented as a pair of rings, one producer-&gt;consumer
avail ring and one consumer-&gt;producer used ring; preceding the
avail ring in memory are two contiguous u16 fields -- avail-&gt;flags
and avail-&gt;idx. A producer posts work by writing to avail-&gt;idx and
a consumer reads avail-&gt;idx.

The flags and idx fields only need to be written by a producer CPU
and only read by a consumer CPU; when the producer and consumer are
running on different CPUs and the virtio_ring code is structured to
only have source writes/sink reads, we can continuously transfer the
avail header cacheline between 'M' states between cores. This flow
optimizes core -&gt; core bandwidth on certain CPUs.

(see: "Software Optimization Guide for AMD Family 15h Processors",
Section 11.6; similar language appears in the 10h guide and should
apply to CPUs w/ exclusive caches, using LLC as a transfer cache)

Unfortunately the existing virtio_ring code issued reads to the
avail-&gt;idx and read-modify-writes to avail-&gt;flags on the producer.

This change shadows the flags and index fields in producer memory;
the vring code now reads from the shadows and only ever writes to
avail-&gt;flags and avail-&gt;idx, allowing the cacheline to transfer
core -&gt; core optimally.

In a concurrent version of vring_bench, the time required for
10,000,000 buffer checkout/returns was reduced by ~2% (average
across many runs) on an AMD Piledriver (15h) CPU:

(w/o shadowing):
 Performance counter stats for './vring_bench':
     5,451,082,016      L1-dcache-loads
     ...
       2.221477739 seconds time elapsed

(w/ shadowing):
 Performance counter stats for './vring_bench':
     5,405,701,361      L1-dcache-loads
     ...
       2.168405376 seconds time elapsed

The further away (in a NUMA sense) virtio producers and consumers are
from each other, the more we expect to benefit. Physical implementations
of virtio devices and implementations of virtio where the consumer polls
vring avail indexes (vhost) should also benefit.

Signed-off-by: Venkatesh Srinivas &lt;venkateshs@google.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
<entry>
<title>virtio: Do not drop __GFP_HIGH in alloc_indirect</title>
<updated>2015-12-07T15:28:11Z</updated>
<author>
<name>Michal Hocko</name>
<email>mhocko@suse.com</email>
</author>
<published>2015-12-01T14:32:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=82107539bbb9db303fb6676c78c836add5680bb0'/>
<id>urn:sha1:82107539bbb9db303fb6676c78c836add5680bb0</id>
<content type='text'>
b92b1b89a33c ("virtio: force vring descriptors to be allocated from
lowmem") tried to exclude highmem pages for descriptors so it cleared
__GFP_HIGHMEM from a given gfp mask. The patch also cleared __GFP_HIGH
which doesn't make much sense for this fix because __GFP_HIGH only
controls access to memory reserves and it doesn't have any influence
on the zone selection. Some of the call paths use GFP_ATOMIC and
dropping __GFP_HIGH will reduce their changes for success because the
lack of access to memory reserves.

Signed-off-by: Michal Hocko &lt;mhocko@suse.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Acked-by: Will Deacon &lt;will.deacon@arm.com&gt;
Reviewed-by: Mel Gorman &lt;mgorman@techsingularity.net&gt;
</content>
</entry>
<entry>
<title>virtio: fix memory leak of virtio ida cache layers</title>
<updated>2015-12-07T15:28:01Z</updated>
<author>
<name>Suman Anna</name>
<email>s-anna@ti.com</email>
</author>
<published>2015-09-17T00:29:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c13f99b7e945dad5273a8b7ee230f4d1f22d3354'/>
<id>urn:sha1:c13f99b7e945dad5273a8b7ee230f4d1f22d3354</id>
<content type='text'>
The virtio core uses a static ida named virtio_index_ida for
assigning index numbers to virtio devices during registration.
The ida core may allocate some internal idr cache layers and
an ida bitmap upon any ida allocation, and all these layers are
truely freed only upon the ida destruction. The virtio_index_ida
is not destroyed at present, leading to a memory leak when using
the virtio core as a module and atleast one virtio device is
registered and unregistered.

Fix this by invoking ida_destroy() in the virtio core module
exit.

Cc: stable@vger.kernel.org
Signed-off-by: Suman Anna &lt;s-anna@ti.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
<entry>
<title>virtio_balloon: do not change memory amount visible via /proc/meminfo</title>
<updated>2015-09-08T10:32:11Z</updated>
<author>
<name>Denis V. Lunev</name>
<email>den@openvz.org</email>
</author>
<published>2015-08-19T21:49:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=997e120843e82609c8d99a9d5714e6cf91e14cbe'/>
<id>urn:sha1:997e120843e82609c8d99a9d5714e6cf91e14cbe</id>
<content type='text'>
Balloon device is frequently used as a mean of cooperative memory control
in between guest and host to manage memory overcommitment. This is the
typical case for any hosting workload when KVM guest is provided for
end-user.

Though there is a problem in this setup. The end-user and hosting provider
have signed SLA agreement in which some amount of memory is guaranted for
the guest. The good thing is that this memory will be given to the guest
when the guest will really need it (f.e. with OOM in guest and with
VIRTIO_BALLOON_F_DEFLATE_ON_OOM configuration flag set). The bad thing
is that end-user does not know this.

Balloon by default reduce the amount of memory exposed to the end-user
each time when the page is stolen from guest or returned back by using
adjust_managed_page_count and thus /proc/meminfo shows reduced amount
of memory.

Fortunately the solution is simple, we should just avoid to call
adjust_managed_page_count with VIRTIO_BALLOON_F_DEFLATE_ON_OOM set.

Signed-off-by: Denis V. Lunev &lt;den@openvz.org&gt;
CC: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
<entry>
<title>virtio_ballon: change stub of release_pages_by_pfn</title>
<updated>2015-09-08T10:31:51Z</updated>
<author>
<name>Denis V. Lunev</name>
<email>den@openvz.org</email>
</author>
<published>2015-08-19T21:49:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b4d34037329f46ed818d3b0a6e1e23b9c8721f79'/>
<id>urn:sha1:b4d34037329f46ed818d3b0a6e1e23b9c8721f79</id>
<content type='text'>
and rename it to release_pages_balloon. The function originally takes
arrays of pfns and now it takes pointer to struct virtio_ballon.
This change is necessary to conditionally call adjust_managed_page_count
in the next patch.

Signed-off-by: Denis V. Lunev &lt;den@openvz.org&gt;
CC: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
</feed>
