* CFP WEBIST 2018 - 14th Int.l Conf. on Web Information Systems and Technologies (Seville/Spain)
From: webist @ 2018-03-12 18:14 UTC (permalink / raw)
To: virtualization
SUBMISSION DEADLINE
14th International Conference on Web Information Systems and Technologies
Submission Deadline: May 2, 2018
http://www.webist.org/
September 18 - 20, 2018
Seville, Spain.
WEBIST is organized in 5 major tracks:
- Internet Technology
- Mobile and NLP Information Systems
- Service Based Information Systems, Platforms and Eco-Systems
- Web Intelligence
- Web Interfaces
A short list of presented papers will be selected so that revised and extended versions of these papers will be published by Springer.
All papers presented at the congress venue will also be available at the SCITEPRESS Digital Library (http://www.scitepress.org/DigitalLibrary/).
Should you have any question please don’t hesitate contacting me.
Kind regards,
WEBIST Secretariat
Address: Av. D. Manuel I, 27A, 2º esq.
2910-595 Setubal, Portugal
Tel: +351 265 100 033
Fax: +351 265 520 186
Web: http://www.webist.org/
e-mail: webist.secretariat@insticc.org
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* CFP PhyCS 2018 - 5th Int.l Conf. on Physiological Computing Systems (Seville/Spain)
From: phycs @ 2018-03-12 18:14 UTC (permalink / raw)
To: virtualization
SUBMISSION DEADLINE
5th International Conference on Physiological Computing Systems
Submission Deadline: May 2, 2018
http://www.phycs.org/
September 19 - 21, 2018
Seville, Spain.
PhyCS is organized in 4 major tracks:
- Devices
- Methodologies and Methods
- Human Factors
- Applications
With the presence of internationally distinguished keynote speakers:
Eduardo Rocon, Consejo Superior de Investigaciones Científicas, Spain
Lucas Noldus, Noldus Information Technology bv, Netherlands
Georgios N. Yannakakis, University of Malta, Malta
A short list of presented papers will be selected so that revised and extended versions of these papers will be published by Springer.
All papers presented at the congress venue will also be available at the SCITEPRESS Digital Library (http://www.scitepress.org/DigitalLibrary/).
Should you have any question please don’t hesitate contacting me.
Kind regards,
PhyCS Secretariat
Address: Av. D. Manuel I, 27A, 2º esq.
2910-595 Setubal, Portugal
Tel: +351 265 520 184
Fax: +351 265 520 186
Web: http://www.phycs.org/
e-mail: phycs.secretariat@insticc.org
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* CFP PECCS 2018 - 8th Int.l Joint Conf. on Pervasive and Embedded Computing and Communication Systems (Porto/Portugal)
From: peccs @ 2018-03-12 18:14 UTC (permalink / raw)
To: virtualization
SUBMISSION DEADLINE
8th International Joint Conference on Pervasive and Embedded Computing and Communication Systems
Submission Deadline: April 3, 2018
http://www.peccs.org/
July 29 - 30, 2018
Porto, Portugal.
In Cooperation with EUROMICRO.
With the presence of internationally distinguished keynote speakers:
Stephan Weiss, University of Strathclyde, United Kingdom
A short list of presented papers will be selected so that revised and extended versions of these papers will be published by Springer.
All papers presented at the congress venue will also be available at the SCITEPRESS Digital Library (http://www.scitepress.org/DigitalLibrary/).
Should you have any question please don’t hesitate contacting me.
Kind regards,
PECCS Secretariat
Address: Av. D. Manuel I, 27A, 2º esq.
2910-595 Setubal, Portugal
Tel: +351 265 520 184
Fax: +351 265 520 186
Web: http://www.peccs.org/
e-mail: peccs.secretariat@insticc.org
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* Re: [PATCH net 0/3] Several fixes for vhost_net ptr_ring usage
From: David Miller @ 2018-03-09 17:03 UTC (permalink / raw)
To: jasowang; +Cc: kvm, mst, netdev, linux-kernel, virtualization, glider, dvyukov
In-Reply-To: <1520578234-5565-1-git-send-email-jasowang@redhat.com>
From: Jason Wang <jasowang@redhat.com>
Date: Fri, 9 Mar 2018 14:50:31 +0800
> This small series try to fix several bugs of ptr_ring usage in
> vhost_net. Please review.
Series applied, thanks Jason.
^ permalink raw reply
* Re: [PATCH net 0/3] Several fixes for vhost_net ptr_ring usage
From: Michael S. Tsirkin @ 2018-03-09 16:57 UTC (permalink / raw)
To: Jason Wang
Cc: kvm, netdev, linux-kernel, virtualization, glider, davem, dvyukov
In-Reply-To: <1520578234-5565-1-git-send-email-jasowang@redhat.com>
On Fri, Mar 09, 2018 at 02:50:31PM +0800, Jason Wang wrote:
> Hi:
>
> This small series try to fix several bugs of ptr_ring usage in
> vhost_net. Please review.
>
> Thanks
ACK series, thanks Jason!
> Alexander Potapenko (1):
> vhost_net: initialize rx_ring in vhost_net_open()
>
> Jason Wang (2):
> vhost_net: keep private_data and rx_ring synced
> vhost_net: examine pointer types during un-producing
>
> drivers/net/tun.c | 3 ++-
> drivers/vhost/net.c | 8 +++++---
> include/linux/if_tun.h | 4 ++++
> 3 files changed, 11 insertions(+), 4 deletions(-)
>
> --
> 2.7.4
^ permalink raw reply
* Re: [PATCH net 2/3] vhost_net: keep private_data and rx_ring synced
From: Michael S. Tsirkin @ 2018-03-09 16:56 UTC (permalink / raw)
To: Jason Wang; +Cc: kvm, netdev, linux-kernel, virtualization, glider, dvyukov
In-Reply-To: <1520578234-5565-3-git-send-email-jasowang@redhat.com>
On Fri, Mar 09, 2018 at 02:50:33PM +0800, Jason Wang wrote:
> We get pointer ring from the exported sock, this means we should keep
> rx_ring and vq->private synced during both vq stop and backend set,
> otherwise we may see stale rx_ring.
>
> Fixes: c67df11f6e480 ("vhost_net: try batch dequing from skb array")
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> drivers/vhost/net.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> index 60f1080..efb9306 100644
> --- a/drivers/vhost/net.c
> +++ b/drivers/vhost/net.c
> @@ -973,6 +973,7 @@ static struct socket *vhost_net_stop_vq(struct vhost_net *n,
> vhost_net_disable_vq(n, vq);
> vq->private_data = NULL;
> vhost_net_buf_unproduce(nvq);
> + nvq->rx_ring = NULL;
> mutex_unlock(&vq->mutex);
> return sock;
> }
> @@ -1162,14 +1163,14 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
> vhost_net_disable_vq(n, vq);
> vq->private_data = sock;
> vhost_net_buf_unproduce(nvq);
> - if (index == VHOST_NET_VQ_RX)
> - nvq->rx_ring = get_tap_ptr_ring(fd);
> r = vhost_vq_init_access(vq);
> if (r)
> goto err_used;
> r = vhost_net_enable_vq(n, vq);
> if (r)
> goto err_used;
> + if (index == VHOST_NET_VQ_RX)
> + nvq->rx_ring = get_tap_ptr_ring(fd);
>
> oldubufs = nvq->ubufs;
> nvq->ubufs = ubufs;
> --
> 2.7.4
^ permalink raw reply
* Re: [PATCH net 1/3] vhost_net: initialize rx_ring in vhost_net_open()
From: Michael S. Tsirkin @ 2018-03-09 16:55 UTC (permalink / raw)
To: Jason Wang; +Cc: kvm, netdev, linux-kernel, virtualization, glider, dvyukov
In-Reply-To: <1520578234-5565-2-git-send-email-jasowang@redhat.com>
On Fri, Mar 09, 2018 at 02:50:32PM +0800, Jason Wang wrote:
> From: Alexander Potapenko <glider@google.com>
>
> KMSAN reported a use of uninit memory in vhost_net_buf_unproduce()
> while trying to access n->vqs[VHOST_NET_VQ_TX].rx_ring:
>
> ==================================================================
> BUG: KMSAN: use of uninitialized memory in vhost_net_buf_unproduce+0x7bb/0x9a0 drivers/vho
> et.c:170
> CPU: 0 PID: 3021 Comm: syz-fuzzer Not tainted 4.16.0-rc4+ #3853
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014
> Call Trace:
> __dump_stack lib/dump_stack.c:17 [inline]
> dump_stack+0x185/0x1d0 lib/dump_stack.c:53
> kmsan_report+0x142/0x1f0 mm/kmsan/kmsan.c:1093
> __msan_warning_32+0x6c/0xb0 mm/kmsan/kmsan_instr.c:676
> vhost_net_buf_unproduce+0x7bb/0x9a0 drivers/vhost/net.c:170
> vhost_net_stop_vq drivers/vhost/net.c:974 [inline]
> vhost_net_stop+0x146/0x380 drivers/vhost/net.c:982
> vhost_net_release+0xb1/0x4f0 drivers/vhost/net.c:1015
> __fput+0x49f/0xa00 fs/file_table.c:209
> ____fput+0x37/0x40 fs/file_table.c:243
> task_work_run+0x243/0x2c0 kernel/task_work.c:113
> tracehook_notify_resume include/linux/tracehook.h:191 [inline]
> exit_to_usermode_loop arch/x86/entry/common.c:166 [inline]
> prepare_exit_to_usermode+0x349/0x3b0 arch/x86/entry/common.c:196
> syscall_return_slowpath+0xf3/0x6d0 arch/x86/entry/common.c:265
> do_syscall_64+0x34d/0x450 arch/x86/entry/common.c:292
> ...
> origin:
> kmsan_save_stack_with_flags mm/kmsan/kmsan.c:303 [inline]
> kmsan_internal_poison_shadow+0xb8/0x1b0 mm/kmsan/kmsan.c:213
> kmsan_kmalloc_large+0x6f/0xd0 mm/kmsan/kmsan.c:392
> kmalloc_large_node_hook mm/slub.c:1366 [inline]
> kmalloc_large_node mm/slub.c:3808 [inline]
> __kmalloc_node+0x100e/0x1290 mm/slub.c:3818
> kmalloc_node include/linux/slab.h:554 [inline]
> kvmalloc_node+0x1a5/0x2e0 mm/util.c:419
> kvmalloc include/linux/mm.h:541 [inline]
> vhost_net_open+0x64/0x5f0 drivers/vhost/net.c:921
> misc_open+0x7b5/0x8b0 drivers/char/misc.c:154
> chrdev_open+0xc28/0xd90 fs/char_dev.c:417
> do_dentry_open+0xccb/0x1430 fs/open.c:752
> vfs_open+0x272/0x2e0 fs/open.c:866
> do_last fs/namei.c:3378 [inline]
> path_openat+0x49ad/0x6580 fs/namei.c:3519
> do_filp_open+0x267/0x640 fs/namei.c:3553
> do_sys_open+0x6ad/0x9c0 fs/open.c:1059
> SYSC_openat+0xc7/0xe0 fs/open.c:1086
> SyS_openat+0x63/0x90 fs/open.c:1080
> do_syscall_64+0x2f1/0x450 arch/x86/entry/common.c:287
> ==================================================================
>
> Fixes: c67df11f6e480 ("vhost_net: try batch dequing from skb array")
> Signed-off-by: Alexander Potapenko <glider@google.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> drivers/vhost/net.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> index 610cba2..60f1080 100644
> --- a/drivers/vhost/net.c
> +++ b/drivers/vhost/net.c
> @@ -948,6 +948,7 @@ static int vhost_net_open(struct inode *inode, struct file *f)
> n->vqs[i].done_idx = 0;
> n->vqs[i].vhost_hlen = 0;
> n->vqs[i].sock_hlen = 0;
> + n->vqs[i].rx_ring = NULL;
> vhost_net_buf_init(&n->vqs[i].rxq);
> }
> vhost_dev_init(dev, vqs, VHOST_NET_VQ_MAX);
> --
> 2.7.4
^ permalink raw reply
* Re: [PATCH] drivers: vhost: vsock: fixed a brace coding style issue
From: David Miller @ 2018-03-09 16:39 UTC (permalink / raw)
To: vaibhavmurkute88; +Cc: kvm, mst, netdev, linux-kernel, virtualization, stefanha
In-Reply-To: <20180309025603.4890-1-vaibhavmurkute88@gmail.com>
From: Vaibhav Murkute <vaibhavmurkute88@gmail.com>
Date: Fri, 9 Mar 2018 08:26:03 +0530
> Fixed a coding style issue.
>
> Signed-off-by: Vaibhav Murkute <vaibhavmurkute88@gmail.com>
Applied to net-next, thanks.
^ permalink raw reply
* Re: [PATCH] drivers: vhost: vsock: fixed a brace coding style issue
From: Stefan Hajnoczi @ 2018-03-09 9:52 UTC (permalink / raw)
To: Vaibhav Murkute; +Cc: kvm, mst, netdev, linux-kernel, virtualization
In-Reply-To: <20180309025603.4890-1-vaibhavmurkute88@gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 312 bytes --]
On Fri, Mar 09, 2018 at 08:26:03AM +0530, Vaibhav Murkute wrote:
> Fixed a coding style issue.
>
> Signed-off-by: Vaibhav Murkute <vaibhavmurkute88@gmail.com>
> ---
> drivers/vhost/vsock.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
[-- Attachment #2: Type: text/plain, Size: 183 bytes --]
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* [PATCH net 3/3] vhost_net: examine pointer types during un-producing
From: Jason Wang @ 2018-03-09 6:50 UTC (permalink / raw)
To: mst, jasowang, kvm, virtualization, netdev, linux-kernel; +Cc: glider, dvyukov
In-Reply-To: <1520578234-5565-1-git-send-email-jasowang@redhat.com>
After commit fc72d1d54dd9 ("tuntap: XDP transmission"), we can
actually queueing XDP pointers in the pointer ring, so we should
examine the pointer type before freeing the pointer.
Fixes: fc72d1d54dd9 ("tuntap: XDP transmission")
Reported-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/net/tun.c | 3 ++-
drivers/vhost/net.c | 2 +-
include/linux/if_tun.h | 4 ++++
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 7433bb2..28cfa64 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -655,7 +655,7 @@ static struct tun_struct *tun_enable_queue(struct tun_file *tfile)
return tun;
}
-static void tun_ptr_free(void *ptr)
+void tun_ptr_free(void *ptr)
{
if (!ptr)
return;
@@ -667,6 +667,7 @@ static void tun_ptr_free(void *ptr)
__skb_array_destroy_skb(ptr);
}
}
+EXPORT_SYMBOL_GPL(tun_ptr_free);
static void tun_queue_purge(struct tun_file *tfile)
{
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index efb9306..8139bc7 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -170,7 +170,7 @@ static void vhost_net_buf_unproduce(struct vhost_net_virtqueue *nvq)
if (nvq->rx_ring && !vhost_net_buf_is_empty(rxq)) {
ptr_ring_unconsume(nvq->rx_ring, rxq->queue + rxq->head,
vhost_net_buf_get_size(rxq),
- __skb_array_destroy_skb);
+ tun_ptr_free);
rxq->head = rxq->tail = 0;
}
}
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
index c5b0a75..fd00170 100644
--- a/include/linux/if_tun.h
+++ b/include/linux/if_tun.h
@@ -25,6 +25,7 @@ struct ptr_ring *tun_get_tx_ring(struct file *file);
bool tun_is_xdp_buff(void *ptr);
void *tun_xdp_to_ptr(void *ptr);
void *tun_ptr_to_xdp(void *ptr);
+void tun_ptr_free(void *ptr);
#else
#include <linux/err.h>
#include <linux/errno.h>
@@ -50,5 +51,8 @@ static inline void *tun_ptr_to_xdp(void *ptr)
{
return NULL;
}
+static inline void tun_ptr_free(void *ptr)
+{
+}
#endif /* CONFIG_TUN */
#endif /* __IF_TUN_H */
--
2.7.4
^ permalink raw reply related
* [PATCH net 2/3] vhost_net: keep private_data and rx_ring synced
From: Jason Wang @ 2018-03-09 6:50 UTC (permalink / raw)
To: mst, jasowang, kvm, virtualization, netdev, linux-kernel; +Cc: glider, dvyukov
In-Reply-To: <1520578234-5565-1-git-send-email-jasowang@redhat.com>
We get pointer ring from the exported sock, this means we should keep
rx_ring and vq->private synced during both vq stop and backend set,
otherwise we may see stale rx_ring.
Fixes: c67df11f6e480 ("vhost_net: try batch dequing from skb array")
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/vhost/net.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 60f1080..efb9306 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -973,6 +973,7 @@ static struct socket *vhost_net_stop_vq(struct vhost_net *n,
vhost_net_disable_vq(n, vq);
vq->private_data = NULL;
vhost_net_buf_unproduce(nvq);
+ nvq->rx_ring = NULL;
mutex_unlock(&vq->mutex);
return sock;
}
@@ -1162,14 +1163,14 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
vhost_net_disable_vq(n, vq);
vq->private_data = sock;
vhost_net_buf_unproduce(nvq);
- if (index == VHOST_NET_VQ_RX)
- nvq->rx_ring = get_tap_ptr_ring(fd);
r = vhost_vq_init_access(vq);
if (r)
goto err_used;
r = vhost_net_enable_vq(n, vq);
if (r)
goto err_used;
+ if (index == VHOST_NET_VQ_RX)
+ nvq->rx_ring = get_tap_ptr_ring(fd);
oldubufs = nvq->ubufs;
nvq->ubufs = ubufs;
--
2.7.4
^ permalink raw reply related
* [PATCH net 1/3] vhost_net: initialize rx_ring in vhost_net_open()
From: Jason Wang @ 2018-03-09 6:50 UTC (permalink / raw)
To: mst, jasowang, kvm, virtualization, netdev, linux-kernel; +Cc: glider, dvyukov
In-Reply-To: <1520578234-5565-1-git-send-email-jasowang@redhat.com>
From: Alexander Potapenko <glider@google.com>
KMSAN reported a use of uninit memory in vhost_net_buf_unproduce()
while trying to access n->vqs[VHOST_NET_VQ_TX].rx_ring:
==================================================================
BUG: KMSAN: use of uninitialized memory in vhost_net_buf_unproduce+0x7bb/0x9a0 drivers/vho
et.c:170
CPU: 0 PID: 3021 Comm: syz-fuzzer Not tainted 4.16.0-rc4+ #3853
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x185/0x1d0 lib/dump_stack.c:53
kmsan_report+0x142/0x1f0 mm/kmsan/kmsan.c:1093
__msan_warning_32+0x6c/0xb0 mm/kmsan/kmsan_instr.c:676
vhost_net_buf_unproduce+0x7bb/0x9a0 drivers/vhost/net.c:170
vhost_net_stop_vq drivers/vhost/net.c:974 [inline]
vhost_net_stop+0x146/0x380 drivers/vhost/net.c:982
vhost_net_release+0xb1/0x4f0 drivers/vhost/net.c:1015
__fput+0x49f/0xa00 fs/file_table.c:209
____fput+0x37/0x40 fs/file_table.c:243
task_work_run+0x243/0x2c0 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:191 [inline]
exit_to_usermode_loop arch/x86/entry/common.c:166 [inline]
prepare_exit_to_usermode+0x349/0x3b0 arch/x86/entry/common.c:196
syscall_return_slowpath+0xf3/0x6d0 arch/x86/entry/common.c:265
do_syscall_64+0x34d/0x450 arch/x86/entry/common.c:292
...
origin:
kmsan_save_stack_with_flags mm/kmsan/kmsan.c:303 [inline]
kmsan_internal_poison_shadow+0xb8/0x1b0 mm/kmsan/kmsan.c:213
kmsan_kmalloc_large+0x6f/0xd0 mm/kmsan/kmsan.c:392
kmalloc_large_node_hook mm/slub.c:1366 [inline]
kmalloc_large_node mm/slub.c:3808 [inline]
__kmalloc_node+0x100e/0x1290 mm/slub.c:3818
kmalloc_node include/linux/slab.h:554 [inline]
kvmalloc_node+0x1a5/0x2e0 mm/util.c:419
kvmalloc include/linux/mm.h:541 [inline]
vhost_net_open+0x64/0x5f0 drivers/vhost/net.c:921
misc_open+0x7b5/0x8b0 drivers/char/misc.c:154
chrdev_open+0xc28/0xd90 fs/char_dev.c:417
do_dentry_open+0xccb/0x1430 fs/open.c:752
vfs_open+0x272/0x2e0 fs/open.c:866
do_last fs/namei.c:3378 [inline]
path_openat+0x49ad/0x6580 fs/namei.c:3519
do_filp_open+0x267/0x640 fs/namei.c:3553
do_sys_open+0x6ad/0x9c0 fs/open.c:1059
SYSC_openat+0xc7/0xe0 fs/open.c:1086
SyS_openat+0x63/0x90 fs/open.c:1080
do_syscall_64+0x2f1/0x450 arch/x86/entry/common.c:287
==================================================================
Fixes: c67df11f6e480 ("vhost_net: try batch dequing from skb array")
Signed-off-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/vhost/net.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 610cba2..60f1080 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -948,6 +948,7 @@ static int vhost_net_open(struct inode *inode, struct file *f)
n->vqs[i].done_idx = 0;
n->vqs[i].vhost_hlen = 0;
n->vqs[i].sock_hlen = 0;
+ n->vqs[i].rx_ring = NULL;
vhost_net_buf_init(&n->vqs[i].rxq);
}
vhost_dev_init(dev, vqs, VHOST_NET_VQ_MAX);
--
2.7.4
^ permalink raw reply related
* [PATCH net 0/3] Several fixes for vhost_net ptr_ring usage
From: Jason Wang @ 2018-03-09 6:50 UTC (permalink / raw)
To: mst, jasowang, kvm, virtualization, netdev, linux-kernel; +Cc: glider, dvyukov
Hi:
This small series try to fix several bugs of ptr_ring usage in
vhost_net. Please review.
Thanks
Alexander Potapenko (1):
vhost_net: initialize rx_ring in vhost_net_open()
Jason Wang (2):
vhost_net: keep private_data and rx_ring synced
vhost_net: examine pointer types during un-producing
drivers/net/tun.c | 3 ++-
drivers/vhost/net.c | 8 +++++---
include/linux/if_tun.h | 4 ++++
3 files changed, 11 insertions(+), 4 deletions(-)
--
2.7.4
^ permalink raw reply
* Re: [PATCH net] vhost_net: examine pointer types during un-producing
From: Jason Wang @ 2018-03-09 6:21 UTC (permalink / raw)
To: mst, netdev, linux-kernel; +Cc: glider, dvyukov, kvm, virtualization
In-Reply-To: <1520565382-4915-1-git-send-email-jasowang@redhat.com>
On 2018年03月09日 11:16, Jason Wang wrote:
> After commit 761876c857cb ("tap: XDP support"), we can actually
> queueing XDP pointers in the pointer ring, so we should examine the
> pointer type before freeing the pointer.
>
> Fixes: 761876c857cb ("tap: XDP support")
Oops, the commit is wrong, let me repost.
Thanks
> Reported-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
> drivers/net/tun.c | 3 ++-
> drivers/vhost/net.c | 2 +-
> include/linux/if_tun.h | 4 ++++
> 3 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index 7433bb2..28cfa64 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -655,7 +655,7 @@ static struct tun_struct *tun_enable_queue(struct tun_file *tfile)
> return tun;
> }
>
> -static void tun_ptr_free(void *ptr)
> +void tun_ptr_free(void *ptr)
> {
> if (!ptr)
> return;
> @@ -667,6 +667,7 @@ static void tun_ptr_free(void *ptr)
> __skb_array_destroy_skb(ptr);
> }
> }
> +EXPORT_SYMBOL_GPL(tun_ptr_free);
>
> static void tun_queue_purge(struct tun_file *tfile)
> {
> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> index 610cba2..54a138f 100644
> --- a/drivers/vhost/net.c
> +++ b/drivers/vhost/net.c
> @@ -170,7 +170,7 @@ static void vhost_net_buf_unproduce(struct vhost_net_virtqueue *nvq)
> if (nvq->rx_ring && !vhost_net_buf_is_empty(rxq)) {
> ptr_ring_unconsume(nvq->rx_ring, rxq->queue + rxq->head,
> vhost_net_buf_get_size(rxq),
> - __skb_array_destroy_skb);
> + tun_ptr_free);
> rxq->head = rxq->tail = 0;
> }
> }
> diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
> index c5b0a75..fd00170 100644
> --- a/include/linux/if_tun.h
> +++ b/include/linux/if_tun.h
> @@ -25,6 +25,7 @@ struct ptr_ring *tun_get_tx_ring(struct file *file);
> bool tun_is_xdp_buff(void *ptr);
> void *tun_xdp_to_ptr(void *ptr);
> void *tun_ptr_to_xdp(void *ptr);
> +void tun_ptr_free(void *ptr);
> #else
> #include <linux/err.h>
> #include <linux/errno.h>
> @@ -50,5 +51,8 @@ static inline void *tun_ptr_to_xdp(void *ptr)
> {
> return NULL;
> }
> +static inline void tun_ptr_free(void *ptr)
> +{
> +}
> #endif /* CONFIG_TUN */
> #endif /* __IF_TUN_H */
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* Re: [PATCH net] vhost_net: examine pointer types during un-producing
From: Michael S. Tsirkin @ 2018-03-09 3:54 UTC (permalink / raw)
To: Jason Wang; +Cc: kvm, netdev, linux-kernel, virtualization, glider, dvyukov
In-Reply-To: <1520565382-4915-1-git-send-email-jasowang@redhat.com>
On Fri, Mar 09, 2018 at 11:16:22AM +0800, Jason Wang wrote:
> After commit 761876c857cb ("tap: XDP support"), we can actually
> queueing XDP pointers in the pointer ring, so we should examine the
> pointer type before freeing the pointer.
>
> Fixes: 761876c857cb ("tap: XDP support")
> Reported-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> drivers/net/tun.c | 3 ++-
> drivers/vhost/net.c | 2 +-
> include/linux/if_tun.h | 4 ++++
> 3 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index 7433bb2..28cfa64 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -655,7 +655,7 @@ static struct tun_struct *tun_enable_queue(struct tun_file *tfile)
> return tun;
> }
>
> -static void tun_ptr_free(void *ptr)
> +void tun_ptr_free(void *ptr)
> {
> if (!ptr)
> return;
> @@ -667,6 +667,7 @@ static void tun_ptr_free(void *ptr)
> __skb_array_destroy_skb(ptr);
> }
> }
> +EXPORT_SYMBOL_GPL(tun_ptr_free);
>
> static void tun_queue_purge(struct tun_file *tfile)
> {
> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> index 610cba2..54a138f 100644
> --- a/drivers/vhost/net.c
> +++ b/drivers/vhost/net.c
> @@ -170,7 +170,7 @@ static void vhost_net_buf_unproduce(struct vhost_net_virtqueue *nvq)
> if (nvq->rx_ring && !vhost_net_buf_is_empty(rxq)) {
> ptr_ring_unconsume(nvq->rx_ring, rxq->queue + rxq->head,
> vhost_net_buf_get_size(rxq),
> - __skb_array_destroy_skb);
> + tun_ptr_free);
> rxq->head = rxq->tail = 0;
> }
> }
> diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
> index c5b0a75..fd00170 100644
> --- a/include/linux/if_tun.h
> +++ b/include/linux/if_tun.h
> @@ -25,6 +25,7 @@ struct ptr_ring *tun_get_tx_ring(struct file *file);
> bool tun_is_xdp_buff(void *ptr);
> void *tun_xdp_to_ptr(void *ptr);
> void *tun_ptr_to_xdp(void *ptr);
> +void tun_ptr_free(void *ptr);
> #else
> #include <linux/err.h>
> #include <linux/errno.h>
> @@ -50,5 +51,8 @@ static inline void *tun_ptr_to_xdp(void *ptr)
> {
> return NULL;
> }
> +static inline void tun_ptr_free(void *ptr)
> +{
> +}
> #endif /* CONFIG_TUN */
> #endif /* __IF_TUN_H */
> --
> 2.7.4
^ permalink raw reply
* [PATCH net] vhost_net: examine pointer types during un-producing
From: Jason Wang @ 2018-03-09 3:16 UTC (permalink / raw)
To: mst, jasowang, netdev, linux-kernel; +Cc: glider, dvyukov, kvm, virtualization
After commit 761876c857cb ("tap: XDP support"), we can actually
queueing XDP pointers in the pointer ring, so we should examine the
pointer type before freeing the pointer.
Fixes: 761876c857cb ("tap: XDP support")
Reported-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/net/tun.c | 3 ++-
drivers/vhost/net.c | 2 +-
include/linux/if_tun.h | 4 ++++
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 7433bb2..28cfa64 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -655,7 +655,7 @@ static struct tun_struct *tun_enable_queue(struct tun_file *tfile)
return tun;
}
-static void tun_ptr_free(void *ptr)
+void tun_ptr_free(void *ptr)
{
if (!ptr)
return;
@@ -667,6 +667,7 @@ static void tun_ptr_free(void *ptr)
__skb_array_destroy_skb(ptr);
}
}
+EXPORT_SYMBOL_GPL(tun_ptr_free);
static void tun_queue_purge(struct tun_file *tfile)
{
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 610cba2..54a138f 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -170,7 +170,7 @@ static void vhost_net_buf_unproduce(struct vhost_net_virtqueue *nvq)
if (nvq->rx_ring && !vhost_net_buf_is_empty(rxq)) {
ptr_ring_unconsume(nvq->rx_ring, rxq->queue + rxq->head,
vhost_net_buf_get_size(rxq),
- __skb_array_destroy_skb);
+ tun_ptr_free);
rxq->head = rxq->tail = 0;
}
}
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
index c5b0a75..fd00170 100644
--- a/include/linux/if_tun.h
+++ b/include/linux/if_tun.h
@@ -25,6 +25,7 @@ struct ptr_ring *tun_get_tx_ring(struct file *file);
bool tun_is_xdp_buff(void *ptr);
void *tun_xdp_to_ptr(void *ptr);
void *tun_ptr_to_xdp(void *ptr);
+void tun_ptr_free(void *ptr);
#else
#include <linux/err.h>
#include <linux/errno.h>
@@ -50,5 +51,8 @@ static inline void *tun_ptr_to_xdp(void *ptr)
{
return NULL;
}
+static inline void tun_ptr_free(void *ptr)
+{
+}
#endif /* CONFIG_TUN */
#endif /* __IF_TUN_H */
--
2.7.4
^ permalink raw reply related
* [PULL] virtio: bugfix
From: Michael S. Tsirkin @ 2018-03-07 23:29 UTC (permalink / raw)
To: Linus Torvalds
Cc: kvm, mst, netdev, linux-kernel, stable, virtualization, luto
The following changes since commit 4a3928c6f8a53fa1aed28ccba227742486e8ddcb:
Linux 4.16-rc3 (2018-02-25 18:50:41 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git tags/for_linus
for you to fetch changes up to e82df670235138575b37ff0ec24412a471efd97f:
virtio_ring: fix num_free handling in error case (2018-03-01 18:53:38 +0200)
----------------------------------------------------------------
virtio: bugfix
This includes a bugfix for error handling in virtio.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
----------------------------------------------------------------
Tiwei Bie (1):
virtio_ring: fix num_free handling in error case
drivers/virtio/virtio_ring.c | 2 --
1 file changed, 2 deletions(-)
^ permalink raw reply
* (unknown),
From: Solen win @ 2018-03-07 7:48 UTC (permalink / raw)
To: virtualization
[-- Attachment #1.1: Type: text/plain, Size: 30 bytes --]
Hi sir
solenwin2.zendesk.com
[-- Attachment #1.2: Type: text/html, Size: 145 bytes --]
[-- Attachment #2: Type: text/plain, Size: 183 bytes --]
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* [PATCH v5 7/7] MAINTAINERS: Add entry for Jailhouse
From: Jan Kiszka @ 2018-03-07 7:39 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, H . Peter Anvin, Bjorn Helgaas
Cc: jailhouse-dev, linux-pci, x86, Linux Kernel Mailing List,
virtualization, Andy Shevchenko
In-Reply-To: <cover.1520408357.git.jan.kiszka@siemens.com>
From: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
MAINTAINERS | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index 4623caf8d72d..6dc0b8f3ae0e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7523,6 +7523,13 @@ Q: http://patchwork.linuxtv.org/project/linux-media/list/
S: Maintained
F: drivers/media/dvb-frontends/ix2505v*
+JAILHOUSE HYPERVISOR INTERFACE
+M: Jan Kiszka <jan.kiszka@siemens.com>
+L: jailhouse-dev@googlegroups.com
+S: Maintained
+F: arch/x86/kernel/jailhouse.c
+F: arch/x86/include/asm/jailhouse_para.h
+
JC42.4 TEMPERATURE SENSOR DRIVER
M: Guenter Roeck <linux@roeck-us.net>
L: linux-hwmon@vger.kernel.org
--
2.13.6
^ permalink raw reply related
* [PATCH v5 6/7] x86/jailhouse: Allow to use PCI_MMCONFIG without ACPI
From: Jan Kiszka @ 2018-03-07 7:39 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, H . Peter Anvin, Bjorn Helgaas
Cc: jailhouse-dev, linux-pci, x86, Linux Kernel Mailing List,
virtualization, Andy Shevchenko
In-Reply-To: <cover.1520408357.git.jan.kiszka@siemens.com>
From: Jan Kiszka <jan.kiszka@siemens.com>
Jailhouse does not use ACPI, but it does support MMCONFIG. Make sure the
latter can be built without having to enable ACPI as well. Primarily, we
need to make the AMD mmconf-fam10h_64 depend upon MMCONFIG and ACPI,
instead of just the former.
Saves some bytes in the Jailhouse non-root kernel.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
arch/x86/Kconfig | 6 +++++-
arch/x86/kernel/Makefile | 2 +-
arch/x86/kernel/cpu/amd.c | 2 +-
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 8986a6b6e3df..b53340e71f84 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2643,7 +2643,7 @@ config PCI_DIRECT
config PCI_MMCONFIG
bool "Support mmconfig PCI config space access" if X86_64
default y
- depends on PCI && (ACPI || SFI)
+ depends on PCI && (ACPI || SFI || JAILHOUSE_GUEST)
depends on X86_64 || (PCI_GOANY || PCI_GOMMCONFIG)
config PCI_OLPC
@@ -2659,6 +2659,10 @@ config PCI_DOMAINS
def_bool y
depends on PCI
+config MMCONF_FAM10H
+ def_bool y
+ depends on X86_64 && PCI_MMCONFIG && ACPI
+
config PCI_CNB20LE_QUIRK
bool "Read CNB20LE Host Bridge Windows" if EXPERT
depends on PCI
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 29786c87e864..73ccf80c09a2 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -146,6 +146,6 @@ ifeq ($(CONFIG_X86_64),y)
obj-$(CONFIG_GART_IOMMU) += amd_gart_64.o aperture_64.o
obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary_64.o tce_64.o
- obj-$(CONFIG_PCI_MMCONFIG) += mmconf-fam10h_64.o
+ obj-$(CONFIG_MMCONF_FAM10H) += mmconf-fam10h_64.o
obj-y += vsmp_64.o
endif
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index f0e6456ca7d3..12bc0a1139da 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -716,7 +716,7 @@ static void init_amd_k8(struct cpuinfo_x86 *c)
static void init_amd_gh(struct cpuinfo_x86 *c)
{
-#ifdef CONFIG_X86_64
+#ifdef CONFIG_MMCONF_FAM10H
/* do this for boot cpu */
if (c == &boot_cpu_data)
check_enable_amd_mmconf_dmi();
--
2.13.6
^ permalink raw reply related
* [PATCH v5 5/7] x86: Consolidate PCI_MMCONFIG configs
From: Jan Kiszka @ 2018-03-07 7:39 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, H . Peter Anvin, Bjorn Helgaas
Cc: jailhouse-dev, linux-pci, x86, Linux Kernel Mailing List,
virtualization, Andy Shevchenko
In-Reply-To: <cover.1520408357.git.jan.kiszka@siemens.com>
From: Jan Kiszka <jan.kiszka@siemens.com>
Since e279b6c1d329 ("x86: start unification of arch/x86/Kconfig.*"), we
have two PCI_MMCONFIG entries, one from the original i386 and another
from x86_64. This consolidates both entries into a single one.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
arch/x86/Kconfig | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index c19f5342ec2b..8986a6b6e3df 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2641,8 +2641,10 @@ config PCI_DIRECT
depends on PCI && (X86_64 || (PCI_GODIRECT || PCI_GOANY || PCI_GOOLPC || PCI_GOMMCONFIG))
config PCI_MMCONFIG
- def_bool y
- depends on X86_32 && PCI && (ACPI || SFI) && (PCI_GOMMCONFIG || PCI_GOANY)
+ bool "Support mmconfig PCI config space access" if X86_64
+ default y
+ depends on PCI && (ACPI || SFI)
+ depends on X86_64 || (PCI_GOANY || PCI_GOMMCONFIG)
config PCI_OLPC
def_bool y
@@ -2657,11 +2659,6 @@ config PCI_DOMAINS
def_bool y
depends on PCI
-config PCI_MMCONFIG
- bool "Support mmconfig PCI config space access"
- default y
- depends on X86_64 && PCI && (ACPI || SFI)
-
config PCI_CNB20LE_QUIRK
bool "Read CNB20LE Host Bridge Windows" if EXPERT
depends on PCI
--
2.13.6
^ permalink raw reply related
* [PATCH v5 4/7] x86: Align x86_64 PCI_MMCONFIG with 32-bit variant
From: Jan Kiszka @ 2018-03-07 7:39 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, H . Peter Anvin, Bjorn Helgaas
Cc: jailhouse-dev, linux-pci, x86, Linux Kernel Mailing List,
virtualization, Andy Shevchenko
In-Reply-To: <cover.1520408357.git.jan.kiszka@siemens.com>
From: Jan Kiszka <jan.kiszka@siemens.com>
Allow to enable PCI_MMCONFIG when only SFI is present and make this
option default on. This will help consolidating both into one Kconfig
statement.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
arch/x86/Kconfig | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index eb7f43f23521..c19f5342ec2b 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2659,7 +2659,8 @@ config PCI_DOMAINS
config PCI_MMCONFIG
bool "Support mmconfig PCI config space access"
- depends on X86_64 && PCI && ACPI
+ default y
+ depends on X86_64 && PCI && (ACPI || SFI)
config PCI_CNB20LE_QUIRK
bool "Read CNB20LE Host Bridge Windows" if EXPERT
--
2.13.6
^ permalink raw reply related
* [PATCH v5 3/7] x86/jailhouse: Enable PCI mmconfig access in inmates
From: Jan Kiszka @ 2018-03-07 7:39 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, H . Peter Anvin, Bjorn Helgaas
Cc: jailhouse-dev, linux-pci, x86, Linux Kernel Mailing List,
virtualization, Andy Shevchenko
In-Reply-To: <cover.1520408357.git.jan.kiszka@siemens.com>
From: Otavio Pontes <otavio.pontes@intel.com>
Use the PCI mmconfig base address exported by jailhouse in boot
parameters in order to access the memory mapped PCI configuration space.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
[Jan: rebased, fixed !CONFIG_PCI_MMCONFIG, used pcibios_last_bus]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
arch/x86/include/asm/pci_x86.h | 2 ++
arch/x86/kernel/jailhouse.c | 8 ++++++++
arch/x86/pci/mmconfig-shared.c | 4 ++--
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/pci_x86.h b/arch/x86/include/asm/pci_x86.h
index eb66fa9cd0fc..959d618dbb17 100644
--- a/arch/x86/include/asm/pci_x86.h
+++ b/arch/x86/include/asm/pci_x86.h
@@ -151,6 +151,8 @@ extern int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end,
phys_addr_t addr);
extern int pci_mmconfig_delete(u16 seg, u8 start, u8 end);
extern struct pci_mmcfg_region *pci_mmconfig_lookup(int segment, int bus);
+extern struct pci_mmcfg_region *__init pci_mmconfig_add(int segment, int start,
+ int end, u64 addr);
extern struct list_head pci_mmcfg_list;
diff --git a/arch/x86/kernel/jailhouse.c b/arch/x86/kernel/jailhouse.c
index b68fd895235a..fa183a131edc 100644
--- a/arch/x86/kernel/jailhouse.c
+++ b/arch/x86/kernel/jailhouse.c
@@ -124,6 +124,14 @@ static int __init jailhouse_pci_arch_init(void)
if (pcibios_last_bus < 0)
pcibios_last_bus = 0xff;
+#ifdef CONFIG_PCI_MMCONFIG
+ if (setup_data.pci_mmconfig_base) {
+ pci_mmconfig_add(0, 0, pcibios_last_bus,
+ setup_data.pci_mmconfig_base);
+ pci_mmcfg_arch_init();
+ }
+#endif
+
return 0;
}
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
index 96684d0adcf9..0e590272366b 100644
--- a/arch/x86/pci/mmconfig-shared.c
+++ b/arch/x86/pci/mmconfig-shared.c
@@ -94,8 +94,8 @@ static struct pci_mmcfg_region *pci_mmconfig_alloc(int segment, int start,
return new;
}
-static struct pci_mmcfg_region *__init pci_mmconfig_add(int segment, int start,
- int end, u64 addr)
+struct pci_mmcfg_region *__init pci_mmconfig_add(int segment, int start,
+ int end, u64 addr)
{
struct pci_mmcfg_region *new;
--
2.13.6
^ permalink raw reply related
* [PATCH v5 2/7] PCI: Scan all functions when running over Jailhouse
From: Jan Kiszka @ 2018-03-07 7:39 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, H . Peter Anvin, Bjorn Helgaas
Cc: jailhouse-dev, Benedikt Spranger, linux-pci, x86,
Linux Kernel Mailing List, virtualization, Andy Shevchenko
In-Reply-To: <cover.1520408357.git.jan.kiszka@siemens.com>
From: Jan Kiszka <jan.kiszka@siemens.com>
Per PCIe r4.0, sec 7.5.1.1.9, multi-function devices are required to
have a function 0. Therefore, Linux scans for devices at function 0
(devfn 0/8/16/...) and only scans for other functions if function 0
has its Multi-Function Device bit set or ARI or SR-IOV indicate
there are more functions.
The Jailhouse hypervisor may pass individual functions of a
multi-function device to a guest without passing function 0, which
means a Linux guest won't find them.
Change Linux PCI probing so it scans all function numbers when
running as a guest over Jailhouse.
This is technically prohibited by the spec, so it is possible that
PCI devices without the Multi-Function Device bit set may have
unexpected behavior in response to this probe.
Derived from original patch by Benedikt Spranger.
CC: Benedikt Spranger <b.spranger@linutronix.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
arch/x86/pci/legacy.c | 4 +++-
drivers/pci/probe.c | 22 +++++++++++++++++++---
2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/arch/x86/pci/legacy.c b/arch/x86/pci/legacy.c
index 1cb01abcb1be..dfbe6ac38830 100644
--- a/arch/x86/pci/legacy.c
+++ b/arch/x86/pci/legacy.c
@@ -4,6 +4,7 @@
#include <linux/init.h>
#include <linux/export.h>
#include <linux/pci.h>
+#include <asm/jailhouse_para.h>
#include <asm/pci_x86.h>
/*
@@ -34,13 +35,14 @@ int __init pci_legacy_init(void)
void pcibios_scan_specific_bus(int busn)
{
+ int stride = jailhouse_paravirt() ? 1 : 8;
int devfn;
u32 l;
if (pci_find_bus(0, busn))
return;
- for (devfn = 0; devfn < 256; devfn += 8) {
+ for (devfn = 0; devfn < 256; devfn += stride) {
if (!raw_pci_read(0, busn, devfn, PCI_VENDOR_ID, 2, &l) &&
l != 0x0000 && l != 0xffff) {
DBG("Found device at %02x:%02x [%04x]\n", busn, devfn, l);
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index ef5377438a1e..3c365dc996e7 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -16,6 +16,7 @@
#include <linux/pci-aspm.h>
#include <linux/aer.h>
#include <linux/acpi.h>
+#include <linux/hypervisor.h>
#include <linux/irqdomain.h>
#include <linux/pm_runtime.h>
#include "pci.h"
@@ -2518,14 +2519,29 @@ static unsigned int pci_scan_child_bus_extend(struct pci_bus *bus,
{
unsigned int used_buses, normal_bridges = 0, hotplug_bridges = 0;
unsigned int start = bus->busn_res.start;
- unsigned int devfn, cmax, max = start;
+ unsigned int devfn, fn, cmax, max = start;
struct pci_dev *dev;
+ int nr_devs;
dev_dbg(&bus->dev, "scanning bus\n");
/* Go find them, Rover! */
- for (devfn = 0; devfn < 0x100; devfn += 8)
- pci_scan_slot(bus, devfn);
+ for (devfn = 0; devfn < 256; devfn += 8) {
+ nr_devs = pci_scan_slot(bus, devfn);
+
+ /*
+ * The Jailhouse hypervisor may pass individual functions of a
+ * multi-function device to a guest without passing function 0.
+ * Look for them as well.
+ */
+ if (jailhouse_paravirt() && nr_devs == 0) {
+ for (fn = 1; fn < 8; fn++) {
+ dev = pci_scan_single_device(bus, devfn + fn);
+ if (dev)
+ dev->multifunction = 1;
+ }
+ }
+ }
/* Reserve buses for SR-IOV capability */
used_buses = pci_iov_bus_range(bus);
--
2.13.6
^ permalink raw reply related
* [PATCH v5 1/7] jailhouse: Provide detection for non-x86 systems
From: Jan Kiszka @ 2018-03-07 7:39 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, H . Peter Anvin, Bjorn Helgaas
Cc: jailhouse-dev, Mark Rutland, Juergen Gross, linux-pci, x86,
Linux Kernel Mailing List, virtualization, Andy Shevchenko,
Rob Herring
In-Reply-To: <cover.1520408357.git.jan.kiszka@siemens.com>
From: Jan Kiszka <jan.kiszka@siemens.com>
Implement jailhouse_paravirt() via device tree probing on architectures
!= x86. Will be used by the PCI core.
CC: Rob Herring <robh+dt@kernel.org>
CC: Mark Rutland <mark.rutland@arm.com>
CC: Juergen Gross <jgross@suse.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
---
Documentation/devicetree/bindings/jailhouse.txt | 8 ++++++++
arch/x86/include/asm/jailhouse_para.h | 2 +-
include/linux/hypervisor.h | 17 +++++++++++++++--
3 files changed, 24 insertions(+), 3 deletions(-)
create mode 100644 Documentation/devicetree/bindings/jailhouse.txt
diff --git a/Documentation/devicetree/bindings/jailhouse.txt b/Documentation/devicetree/bindings/jailhouse.txt
new file mode 100644
index 000000000000..2901c25ff340
--- /dev/null
+++ b/Documentation/devicetree/bindings/jailhouse.txt
@@ -0,0 +1,8 @@
+Jailhouse non-root cell device tree bindings
+--------------------------------------------
+
+When running in a non-root Jailhouse cell (partition), the device tree of this
+platform shall have a top-level "hypervisor" node with the following
+properties:
+
+- compatible = "jailhouse,cell"
diff --git a/arch/x86/include/asm/jailhouse_para.h b/arch/x86/include/asm/jailhouse_para.h
index 875b54376689..b885a961a150 100644
--- a/arch/x86/include/asm/jailhouse_para.h
+++ b/arch/x86/include/asm/jailhouse_para.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL2.0 */
/*
- * Jailhouse paravirt_ops implementation
+ * Jailhouse paravirt detection
*
* Copyright (c) Siemens AG, 2015-2017
*
diff --git a/include/linux/hypervisor.h b/include/linux/hypervisor.h
index b19563f9a8eb..fc08b433c856 100644
--- a/include/linux/hypervisor.h
+++ b/include/linux/hypervisor.h
@@ -8,15 +8,28 @@
*/
#ifdef CONFIG_X86
+
+#include <asm/jailhouse_para.h>
#include <asm/x86_init.h>
+
static inline void hypervisor_pin_vcpu(int cpu)
{
x86_platform.hyper.pin_vcpu(cpu);
}
-#else
+
+#else /* !CONFIG_X86 */
+
+#include <linux/of.h>
+
static inline void hypervisor_pin_vcpu(int cpu)
{
}
-#endif
+
+static inline bool jailhouse_paravirt(void)
+{
+ return of_find_compatible_node(NULL, NULL, "jailhouse,cell");
+}
+
+#endif /* !CONFIG_X86 */
#endif /* __LINUX_HYPEVISOR_H */
--
2.13.6
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox