Re: [PATCH net V4] vhost: log dirty page correctly

2019-01-17 Thread David Miller
From: Jason Wang Date: Wed, 16 Jan 2019 16:54:42 +0800 > Vhost dirty page logging API is designed to sync through GPA. But we > try to log GIOVA when device IOTLB is enabled. This is wrong and may > lead to missing data after migration. > > To solve this issue, when logging with device IOTLB ena

[PATCH net 1/7] virtio_net: Don't enable NAPI when interface is down

2019-01-17 Thread Toshiaki Makita
Commit 4e09ff536284 ("virtio-net: disable NAPI only when enabled during XDP set") tried to fix inappropriate NAPI enabling/disabling when !netif_running(), but was not complete. On error path virtio_net could enable NAPI even when !netif_running(). This can cause enabling NAPI twice on virtnet_ope

[PATCH net 0/7] virtio_net: Fix problems around XDP tx and napi_tx

2019-01-17 Thread Toshiaki Makita
While I'm looking into how to account standard tx counters on XDP tx processing, I found several bugs around XDP tx and napi_tx. Patch1: Fix oops on error path. Patch2 depends on this. Patch2: Fix memory corruption on freeing xdp_frames with napi_tx enabled. Patch3: Minor fix patch5 depends on. Pa

Re: [PATCH] drm: Split out drm_probe_helper.h

2019-01-17 Thread Daniel Vetter
On Wed, Jan 16, 2019 at 07:10:18PM +0100, Sam Ravnborg wrote: > Hi Daniel. > > > v5: Actually try to sort them, and while at it, sort all the ones I > > touch. > > Applied this variant on top of drm-misc and did a build test. > Looked good for ia64, x86 and alpha. > > Took a closer look at the c

Re: [PATCH] drm: Split out drm_probe_helper.h

2019-01-17 Thread Sam Ravnborg
On Thu, Jan 17, 2019 at 05:45:41PM +0100, Daniel Vetter wrote: > On Wed, Jan 16, 2019 at 07:10:18PM +0100, Sam Ravnborg wrote: > > Hi Daniel. > > > > > v5: Actually try to sort them, and while at it, sort all the ones I > > > touch. > > > > Applied this variant on top of drm-misc and did a build

Re: [PATCH net 0/7] virtio_net: Fix problems around XDP tx and napi_tx

2019-01-17 Thread Michael S. Tsirkin
On Thu, Jan 17, 2019 at 08:20:38PM +0900, Toshiaki Makita wrote: > While I'm looking into how to account standard tx counters on XDP tx > processing, I found several bugs around XDP tx and napi_tx. > > Patch1: Fix oops on error path. Patch2 depends on this. > Patch2: Fix memory corruption on freei

Re: [PATCH net 6/7] virtio_net: Use xdp_return_frame to free xdp_frames on destroying vqs

2019-01-17 Thread Jesper Dangaard Brouer
On Thu, 17 Jan 2019 20:56:39 +0800 Jason Wang wrote: > On 2019/1/17 下午7:20, Toshiaki Makita wrote: > > put_page() can work as a fallback for freeing xdp_frames, but the > > appropriate way is to use xdp_return_frame(). > > > > Fixes: cac320c850ef ("virtio_net: convert to use generic xdp_frame and

Re: [PATCH net-next] virtio_net: bulk free tx skbs

2019-01-17 Thread Michael S. Tsirkin
On Wed, Jan 16, 2019 at 03:31:58PM -0800, David Miller wrote: > From: "Michael S. Tsirkin" > Date: Mon, 14 Jan 2019 20:34:26 -0500 > > > Use napi_consume_skb() to get bulk free. Note that napi_consume_skb is > > safe to call in a non-napi context as long as the napi_budget flag is > > correct. >

Re: [PATCH RFC 1/2] virtio-net: bql support

2019-01-17 Thread Jason Wang
On 2019/1/2 下午9:54, Michael S. Tsirkin wrote: On Wed, Jan 02, 2019 at 11:30:11AM +0800, Jason Wang wrote: On 2018/12/31 上午2:48, Michael S. Tsirkin wrote: On Thu, Dec 27, 2018 at 06:04:53PM +0800, Jason Wang wrote: On 2018/12/26 下午11:22, Michael S. Tsirkin wrote: On Thu, Dec 06, 2018 at 04:17

Re: [PATCH net 5/7] virtio_net: Don't process redirected XDP frames when XDP is disabled

2019-01-17 Thread Jason Wang
On 2019/1/17 下午8:53, Jason Wang wrote: On 2019/1/17 下午7:20, Toshiaki Makita wrote: Commit 8dcc5b0ab0ec ("virtio_net: fix ndo_xdp_xmit crash towards dev not ready for XDP") tried to avoid access to unexpected sq while XDP is disabled, but was not complete. There was a small window which causes

Re: [PATCH net 7/7] virtio_net: Differentiate sk_buff and xdp_frame on freeing

2019-01-17 Thread Jason Wang
On 2019/1/17 7:20, Toshiaki Makita wrote: We do not reset or free up unused buffers when enabling/disabling XDP, so it can happen that xdp_frames are freed after disabling XDP or sk_buffs are freed after enabling XDP on xdp tx queues. Thus we need to handle both forms (xdp_frames and sk_buffs)

Re: [PATCH net 6/7] virtio_net: Use xdp_return_frame to free xdp_frames on destroying vqs

2019-01-17 Thread Jason Wang
On 2019/1/17 下午7:20, Toshiaki Makita wrote: put_page() can work as a fallback for freeing xdp_frames, but the appropriate way is to use xdp_return_frame(). Fixes: cac320c850ef ("virtio_net: convert to use generic xdp_frame and xdp_return_frame API") Signed-off-by: Toshiaki Makita --- driver

Re: [PATCH net 5/7] virtio_net: Don't process redirected XDP frames when XDP is disabled

2019-01-17 Thread Jason Wang
On 2019/1/17 下午7:20, Toshiaki Makita wrote: Commit 8dcc5b0ab0ec ("virtio_net: fix ndo_xdp_xmit crash towards dev not ready for XDP") tried to avoid access to unexpected sq while XDP is disabled, but was not complete. There was a small window which causes out of bounds sq access in virtnet_xdp_x

Re: [PATCH net 4/7] virtio_net: Fix out of bounds access of sq

2019-01-17 Thread Jason Wang
On 2019/1/17 下午7:20, Toshiaki Makita wrote: When XDP is disabled, curr_queue_pairs + smp_processor_id() can be larger than max_queue_pairs. There is no guarantee that we have enough XDP send queues dedicated for each cpu when XDP is disabled, so do not count drops on sq in that case. Fixes: 5b8

Re: [PATCH net 3/7] virtio_net: Fix not restoring real_num_rx_queues

2019-01-17 Thread Jason Wang
On 2019/1/17 下午7:20, Toshiaki Makita wrote: When _virtnet_set_queues() failed we did not restore real_num_rx_queues. Fix this by placing the change of real_num_rx_queues after _virtnet_set_queues(). This order is also in line with virtnet_set_channels(). Fixes: 4941d472bf95 ("virtio-net: do not

Re: [PATCH net 2/7] virtio_net: Don't call free_old_xmit_skbs for xdp_frames

2019-01-17 Thread Jason Wang
On 2019/1/17 下午7:20, Toshiaki Makita wrote: When napi_tx is enabled, virtnet_poll_cleantx() called free_old_xmit_skbs() even for xdp send queue. This is bogus since the queue has xdp_frames, not sk_buffs, thus mangled device tx bytes counters because skb->len is meaningless value, and even trigg

Re: [PATCH net 1/7] virtio_net: Don't enable NAPI when interface is down

2019-01-17 Thread Jason Wang
On 2019/1/17 下午7:20, Toshiaki Makita wrote: Commit 4e09ff536284 ("virtio-net: disable NAPI only when enabled during XDP set") tried to fix inappropriate NAPI enabling/disabling when !netif_running(), but was not complete. On error path virtio_net could enable NAPI even when !netif_running(). Th

[PATCH net 7/7] virtio_net: Differentiate sk_buff and xdp_frame on freeing

2019-01-17 Thread Toshiaki Makita
We do not reset or free up unused buffers when enabling/disabling XDP, so it can happen that xdp_frames are freed after disabling XDP or sk_buffs are freed after enabling XDP on xdp tx queues. Thus we need to handle both forms (xdp_frames and sk_buffs) regardless of XDP setting. One way to trigger

[PATCH net 6/7] virtio_net: Use xdp_return_frame to free xdp_frames on destroying vqs

2019-01-17 Thread Toshiaki Makita
put_page() can work as a fallback for freeing xdp_frames, but the appropriate way is to use xdp_return_frame(). Fixes: cac320c850ef ("virtio_net: convert to use generic xdp_frame and xdp_return_frame API") Signed-off-by: Toshiaki Makita --- drivers/net/virtio_net.c | 2 +- 1 file changed, 1 ins

[PATCH net 5/7] virtio_net: Don't process redirected XDP frames when XDP is disabled

2019-01-17 Thread Toshiaki Makita
Commit 8dcc5b0ab0ec ("virtio_net: fix ndo_xdp_xmit crash towards dev not ready for XDP") tried to avoid access to unexpected sq while XDP is disabled, but was not complete. There was a small window which causes out of bounds sq access in virtnet_xdp_xmit() while disabling XDP. An example case of

[PATCH net 4/7] virtio_net: Fix out of bounds access of sq

2019-01-17 Thread Toshiaki Makita
When XDP is disabled, curr_queue_pairs + smp_processor_id() can be larger than max_queue_pairs. There is no guarantee that we have enough XDP send queues dedicated for each cpu when XDP is disabled, so do not count drops on sq in that case. Fixes: 5b8f3c8d30a6 ("virtio_net: Add XDP related stats")

[PATCH net 3/7] virtio_net: Fix not restoring real_num_rx_queues

2019-01-17 Thread Toshiaki Makita
When _virtnet_set_queues() failed we did not restore real_num_rx_queues. Fix this by placing the change of real_num_rx_queues after _virtnet_set_queues(). This order is also in line with virtnet_set_channels(). Fixes: 4941d472bf95 ("virtio-net: do not reset during XDP set") Signed-off-by: Toshiaki

[PATCH net 2/7] virtio_net: Don't call free_old_xmit_skbs for xdp_frames

2019-01-17 Thread Toshiaki Makita
When napi_tx is enabled, virtnet_poll_cleantx() called free_old_xmit_skbs() even for xdp send queue. This is bogus since the queue has xdp_frames, not sk_buffs, thus mangled device tx bytes counters because skb->len is meaningless value, and even triggered oops due to general protection fault on fr