Re: [RFC PATCH 0/2] use larger max_request_size for virtio_blk

2018-04-07 Thread Weiping Zhang
2018-04-05 22:29 GMT+08:00 Jens Axboe <ax...@kernel.dk>: > On 4/5/18 4:09 AM, Weiping Zhang wrote: >> Hi, >> >> For virtio block device, actually there is no a hard limit for max request >> size, and virtio_blk driver set -1 to blk_queue_max_hw_sectors(q, -1U);

[RFC PATCH 0/2] use larger max_request_size for virtio_blk

2018-04-05 Thread Weiping Zhang
blk_queue_max_hw_sectors_no_limit to set a proper max reqeust size. Weiping Zhang (2): blk-setting: add new helper blk_queue_max_hw_sectors_no_limit virtio_blk: add new module parameter to set max request size block/blk-settings.c | 20 drivers/block/virtio_blk.c | 32

[RFC PATCH 1/2] blk-setting: add new helper blk_queue_max_hw_sectors_no_limit

2018-04-05 Thread Weiping Zhang
There is a default upper limitation BLK_DEF_MAX_SECTORS, but for some virtual block device driver there is no such limitation. So add a new help to set max request size. Signed-off-by: Weiping Zhang <zhangweip...@didichuxing.com> --- block/blk-settings.c | 20 i

[RFC PATCH 2/2] virtio_blk: add new module parameter to set max request size

2018-04-05 Thread Weiping Zhang
Actually there is no upper limitation, so add new module parameter to provide a way to set a proper max request size for virtio block. Using a larger request size can improve sequence performance in theory, and reduce the interaction between guest and hypervisor. Signed-off-by: Weiping Zhang

[RFC PATCH] virtio: add space for device features show

2017-12-26 Thread weiping zhang
make features string more readable, add space every 8bit. example: 00101010 0111 1100 Signed-off-by: weiping zhang <zhangweip...@didichuxing.com> --- drivers/virtio/virtio.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/virtio/virt

[PATCH v5 3/4] virtio_vop: don't kfree device on register failure

2017-12-21 Thread weiping zhang
led. Signed-off-by: weiping zhang <zhangweip...@didichuxing.com> Reviewed-by: Cornelia Huck <coh...@redhat.com> --- drivers/misc/mic/vop/vop_main.c | 20 +--- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/misc/mic/vop/vop_main.c b/drivers/misc/mic

[PATCH v5 4/4] virtio_remoteproc: correct put_device virtio_device.dev

2017-12-21 Thread weiping zhang
rproc_virtio_dev_release will be called iff virtio_device.dev's reference count drops to 0. Here we just put vdev.dev, and then rproc->dev's cleanup will be done in rproc_virtio_dev_release. Signed-off-by: weiping zhang <zhangweip...@didichuxing.com> --- drivers/remoteproc/remoteproc

[PATCH v5 2/4] virtio_pci: don't kfree device on register failure

2017-12-21 Thread weiping zhang
led. Signed-off-by: weiping zhang <zhangweip...@didichuxing.com> Reviewed-by: Cornelia Huck <coh...@redhat.com> --- drivers/virtio/virtio_pci_common.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virt

[PATCH v5 1/4] virtio: split device_register into device_initialize and device_add

2017-12-21 Thread weiping zhang
In order to make caller do a simple cleanup, we split device_register into device_initialize and device_add. device_initialize always succeeds, so the caller can always use put_device when register_virtio_device faild. Signed-off-by: weiping zhang <zhangweip...@didichuxing.com> Sug

[PATCH v5 0/4] use put_device to cleanup resource

2017-12-21 Thread weiping zhang
add comments in commit message for why using put_device * virtio_vop: also use put_device int _vop_remove_device weiping zhang (4): virtio: split device_register into device_initialize and device_add virtio_pci: don't kfree device on register failure virtio_vop: don't kfree device on regi

Re: [PATCH v4 4/4] virtio_remoteproc: don't kfree device on register failure

2017-12-20 Thread weiping zhang
2017-12-21 0:12 GMT+08:00 Cornelia Huck <coh...@redhat.com>: > On Wed, 20 Dec 2017 12:27:33 +0800 > weiping zhang <zwp10...@gmail.com> wrote: > >> rproc_virtio_dev_release will be called iff virtio_device.dev's >> refer count became to 0. Here we should

Re: [PATCH v4 1/4] virtio: split device_register into device_initialize and device_add

2017-12-20 Thread weiping zhang
2017-12-21 10:37 GMT+08:00 weiping zhang <zwp10...@gmail.com>: > 2017-12-20 23:53 GMT+08:00 Cornelia Huck <coh...@redhat.com>: >> On Wed, 20 Dec 2017 12:26:25 +0800 >> weiping zhang <zwp10...@gmail.com> wrote: >> >> [you used a different mail addre

Re: [PATCH v4 1/4] virtio: split device_register into device_initialize and device_add

2017-12-20 Thread weiping zhang
2017-12-20 23:53 GMT+08:00 Cornelia Huck <coh...@redhat.com>: > On Wed, 20 Dec 2017 12:26:25 +0800 > weiping zhang <zwp10...@gmail.com> wrote: > > [you used a different mail address in your From: than in your s-o-b:; > same for the other patches] > >> In orde

[PATCH v4 4/4] virtio_remoteproc: don't kfree device on register failure

2017-12-19 Thread weiping zhang
off-by: weiping zhang <zhangweip...@didichuxing.com> --- drivers/remoteproc/remoteproc_virtio.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c index 2946348..1073ea3 100644 ---

[PATCH v4 3/4] virtio_vop: don't kfree device on register failure

2017-12-19 Thread weiping zhang
led. Signed-off-by: weiping zhang <zhangweip...@didichuxing.com> --- drivers/misc/mic/vop/vop_main.c | 20 +--- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/misc/mic/vop/vop_main.c b/drivers/misc/mic/vop/vop_main.c index a341938..3633202 100644 --- a/dri

[PATCH v4 1/4] virtio: split device_register into device_initialize and device_add

2017-12-19 Thread weiping zhang
In order to make caller do a simple cleanup, we split device_register into device_initialize and device_add. device_initialize always sucess, the caller can always use put_device when fail to register virtio_device no matter fail at ida_simple_get or at device_add. Signed-off-by: weiping zhang

[PATCH v4 2/4] virtio_pci: don't kfree device on register failure

2017-12-19 Thread weiping zhang
led. Signed-off-by: weiping zhang <zhangweip...@didichuxing.com> --- drivers/virtio/virtio_pci_common.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c index 1c4797e..48d4d1c 100644 --- a/drive

[PATCH v4 0/4] use put_device to cleanup resource

2017-12-19 Thread weiping zhang
use put_device when fail to register virtio device. v2->v3: * virtio: add new helper do get device's status then determine use put_device or kfree. v1->v2: * virtio_pci: add comments in commit message for why using put_device * virtio_vop: also use put_device int _vop_remove_device weip

[PATCH v3 5/5] virtio: add comments for virtio_register_device

2017-12-17 Thread weiping zhang
een initialized. Signed-off-by: weiping zhang <zhangweip...@didichuxing.com> --- drivers/virtio/virtio.c | 13 + 1 file changed, 13 insertions(+) diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index c5b057bd..4f0718b 100644 --- a/drivers/virtio/virtio.c +++ b/drive

[PATCH v3 4/5] virtio_remoteproc: don't kfree device on register failure

2017-12-17 Thread weiping zhang
off-by: weiping zhang <zhangweip...@didichuxing.com> --- drivers/remoteproc/remoteproc_virtio.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c index 2946348..ad5d6d1 100644 --- a/drivers/r

[PATCH v3 3/5] virtio_vop: don't kfree device on register failure

2017-12-17 Thread weiping zhang
led. Signed-off-by: weiping zhang <zhangweip...@didichuxing.com> --- drivers/misc/mic/vop/vop_main.c | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/misc/mic/vop/vop_main.c b/drivers/misc/mic/vop/vop_main.c index a341938..53eaa9d 100644 --- a/drivers

[PATCH v3 1/5] virtio: add helper virtio_get_status

2017-12-17 Thread weiping zhang
add helper function to simplify dev->config->get_status(). Signed-off-by: weiping zhang <zhangweip...@didichuxing.com> --- drivers/virtio/virtio.c | 6 ++ include/linux/virtio_config.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/drivers/virtio/virtio.c b/dr

[PATCH v3 0/5] proper cleanup if fail to register_virtio_device

2017-12-17 Thread weiping zhang
. weiping zhang (5): virtio: add helper virtio_get_status virtio_pci: don't kfree device on register failure virtio_vop: don't kfree device on register failure virtio_remoteproc: don't kfree device on register failure virtio: add comments for virtio_register_device drivers/misc/mic/vop

Re: [PATCHv2] virtio_mmio: fix devm cleanup

2017-12-14 Thread weiping zhang
; > > [3.810220] ret_from_fork+0x10/0x18 >> > > >> > > To fix this, we can simply rip out the explicit cleanup that the devm >> > > infrastructure will do for us when our probe function returns an error >> > > code, or when our remove function returns. &g

Re: [PATCH v2 1/3] virtio_pci: use put_device instead of kfree

2017-12-14 Thread weiping zhang
2017-12-15 3:13 GMT+08:00 Michael S. Tsirkin <m...@redhat.com>: > On Tue, Dec 12, 2017 at 09:24:02PM +0800, weiping zhang wrote: >> As mentioned at drivers/base/core.c: >> /* >> * NOTE: _Never_ directly free @dev after calling this function, even >> * if

Re: [PATCHv2] virtio_mmio: fix devm cleanup

2017-12-12 Thread weiping zhang
2017-12-12 22:45 GMT+08:00 Mark Rutland <mark.rutl...@arm.com>: > On Tue, Dec 12, 2017 at 10:26:24PM +0800, weiping zhang wrote: >> 2017-12-12 21:45 GMT+08:00 Mark Rutland <mark.rutl...@arm.com>: >> Hi Mark, > > Hi, > >> thanks your patch, I dig into the

[PATCH v2 3/3] virtio: put reference count of virtio_device.dev

2017-12-12 Thread weiping zhang
rproc_virtio_dev_release will be called iff virtio_device.dev's refer count became to 0. Here we should put vdev.dev, and then rproc->dev's cleanup will be done in rproc_virtio_dev_release. Signed-off-by: weiping zhang <zhangweip...@didichuxing.com> Reviewed-by: Cornelia Huck <coh..

[PATCH v2 1/3] virtio_pci: use put_device instead of kfree

2017-12-12 Thread weiping zhang
led. Signed-off-by: weiping zhang <zhangweip...@didichuxing.com> Reviewed-by: Cornelia Huck <coh...@redhat.com> --- drivers/virtio/virtio_pci_common.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/virtio/virtio_pci_common.c b

[PATCH v2 2/3] virtio: use put_device instead of kfree

2017-12-12 Thread weiping zhang
. Signed-off-by: weiping zhang <zhangweip...@didichuxing.com> --- drivers/misc/mic/vop/vop_main.c | 18 ++ 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/misc/mic/vop/vop_main.c b/drivers/misc/mic/vop/vop_main.c index a341938..456e969 100644 --- a/drivers/mi

[PATCH v2 0/3] fix cleanup for fail to register_virtio_device

2017-12-12 Thread weiping zhang
This series fix the cleanup for the caller of register_virtio_device, the main work is use put_device instead of kfree. V1->V2: * virtio_pci: add comments for the reason use put_device * virtio vop: also use put_device in in _vop_remove_device() weiping zhang (3): virtio_pci: use put_dev

Re: [PATCH 2/3] virtio: use put_device instead of kfree

2017-12-12 Thread weiping zhang
On Tue, Dec 12, 2017 at 11:17:42AM +0100, Cornelia Huck wrote: > On Mon, 11 Dec 2017 23:55:26 +0800 > weiping zhang <zhangweip...@didichuxing.com> wrote: > > > don't free vp_vdev until vp_vdev.dev.release be called. > > Same comment as for the virtio_pci p

Re: [PATCH 1/3] virtio_pci: use put_device instead of kfree

2017-12-12 Thread weiping zhang
On Tue, Dec 12, 2017 at 11:00:25AM +0100, Cornelia Huck wrote: > On Mon, 11 Dec 2017 23:55:16 +0800 > weiping zhang <zhangweip...@didichuxing.com> wrote: > > > don't free vp_dev until vp_dev->vdev.dev.release be called. > > Maybe add the same description a

[PATCH 1/3] virtio_pci: use put_device instead of kfree

2017-12-11 Thread weiping zhang
don't free vp_dev until vp_dev->vdev.dev.release be called. Signed-off-by: weiping zhang <zhangweip...@didichuxing.com> --- drivers/virtio/virtio_pci_common.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/virtio/virtio_pci_common.c

[PATCH 3/3] virtio: put reference count of virtio_device.dev

2017-12-11 Thread weiping zhang
rproc_virtio_dev_release will be called iff virtio_device.dev's refer count became to 0. Here we should put vdev.dev, and then rproc->dev's cleanup will be done in rproc_virtio_dev_release. Signed-off-by: weiping zhang <zhangweip...@didichuxing.com> --- drivers/remoteproc/remoteproc_vir

[PATCH 2/3] virtio: use put_device instead of kfree

2017-12-11 Thread weiping zhang
don't free vp_vdev until vp_vdev.dev.release be called. Signed-off-by: weiping zhang <zhangweip...@didichuxing.com> --- drivers/misc/mic/vop/vop_main.c | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/misc/mic/vop/vop_main.c b/drivers/misc/m

[PATCH 0/3] fix cleanup for fail to register_virtio_device

2017-12-11 Thread weiping zhang
This series fix the cleanup for the caller of register_virtio_device, the main work is use put_device instead of kfree. weiping zhang (3): virtio_pci: use put_device instead of kfree virtio: use put_device instead of kfree virtio: put reference count of virtio_device.dev drivers/misc/mic

[PATCH v3 1/2] virtio_mmio: add cleanup for virtio_mmio_probe

2017-12-06 Thread weiping zhang
. Signed-off-by: weiping zhang <zhangweip...@didichuxing.com> --- drivers/virtio/virtio_mmio.c | 51 +++- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index 74dc717..ec40104

[PATCH v3 0/2] Add cleanup for virtio_mmio driver

2017-12-06 Thread weiping zhang
this patchset try to add cleanup for virtio_mmio driver, include virtio_mmio_probe and virtio_mmio_remove weiping zhang (2): virtio_mmio: add cleanup for virtio_mmio_probe virtio_mmio: add cleanup for virtio_mmio_remove drivers/virtio/virtio_mmio.c | 57

[PATCH v3 2/2] virtio_mmio: add cleanup for virtio_mmio_remove

2017-12-06 Thread weiping zhang
cleanup all resource allocated by virtio_mmio_probe. Signed-off-by: weiping zhang <zhangweip...@didichuxing.com> --- drivers/virtio/virtio_mmio.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index ec40104..a9192fe

Re: [PATCH v2 1/2] virtio_mmio: add cleanup for virtio_mmio_probe

2017-12-06 Thread weiping zhang
2017-12-06 19:11 GMT+08:00 Cornelia Huck <coh...@redhat.com>: > On Tue, 5 Dec 2017 19:57:10 +0800 > weiping zhang <zhangweip...@didichuxing.com> wrote: > >> As mentioned at drivers/base/core.c: >> /* >> * NOTE: _Never_ directly free @dev after calling t

[PATCH v2 1/2] virtio_mmio: add cleanup for virtio_mmio_probe

2017-12-05 Thread weiping zhang
), but in this case we need release @mem resource from @pdev and vm_dev->base. It make @pdev->vm_dev.dev.release() too complicated, so put_device just put the reference of register_virtio_device->device_register->device_initialize and release all resource in virtio_mmio_probe. Signed-off-by: w

[PATCH v2 0/2] Add cleanup for virtio_mmio driver

2017-12-05 Thread weiping zhang
this patchset try to add cleanup for virtio_mmio driver, include virtio_mmio_probe and virtio_mmio_remove weiping zhang (2): virtio_mmio: add cleanup for virtio_mmio_probe virtio_mmio: add cleanup for virtio_mmio_remove drivers/virtio/virtio_mmio.c | 43

[PATCH v2 2/2] virtio_mmio: add cleanup for virtio_mmio_remove

2017-12-05 Thread weiping zhang
cleanup all resource allocated by virtio_mmio_probe. Signed-off-by: weiping zhang <zhangweip...@didichuxing.com> --- drivers/virtio/virtio_mmio.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index f984510..5e2ca34

Re: [PATCH] virtio_mmio: add cleanup for virtio_mmio_probe

2017-12-04 Thread weiping zhang
2017-12-04 18:24 GMT+08:00 Cornelia Huck <coh...@redhat.com>: > On Sat, 2 Dec 2017 01:51:40 +0800 > weiping zhang <zwp10...@gmail.com> wrote: > >> cleanup all resource allocated by virtio_mmio_probe. >> >> Signed-off-by: weiping zhang <zhangweip...@

Re: [PATCH] virtio: release virtio index when fail to device_register

2017-12-04 Thread weiping zhang
2017-12-04 17:38 GMT+08:00 Cornelia Huck <coh...@redhat.com>: > On Sat, 2 Dec 2017 00:55:39 +0800 > weiping zhang <zwp10...@gmail.com> wrote: > >> On Wed, Nov 29, 2017 at 10:50:44AM +0100, Cornelia Huck wrote: > >> > We hold an extra reference to

[PATCH] virtio: release virtio index when fail to device_register

2017-12-01 Thread weiping zhang
index can be reused by other virtio device. Signed-off-by: weiping zhang <zhangweip...@didichuxing.com> --- drivers/virtio/virtio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 48230a5..bf7ff39 100644 --- a/drivers/virtio/vi

[PATCH] virtio_mmio: add cleanup for virtio_mmio_probe

2017-12-01 Thread weiping zhang
cleanup all resource allocated by virtio_mmio_probe. Signed-off-by: weiping zhang <zhangweip...@didichuxing.com> --- drivers/virtio/virtio_mmio.c | 34 ++ 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/drivers/virtio/virtio_mmio.c b/drivers/

Re: [PATCH] virtio: release virtio index when fail to device_register

2017-12-01 Thread weiping zhang
2017-12-02 0:55 GMT+08:00 weiping zhang <zwp10...@gmail.com>: > On Wed, Nov 29, 2017 at 10:50:44AM +0100, Cornelia Huck wrote: >> On Wed, 29 Nov 2017 09:23:01 +0800 >> weiping zhang <zwp10...@gmail.com> wrote: >> >> > index can be reused by other virti

[PATCH] virtio: release virtio index when fail to device_register

2017-11-28 Thread weiping zhang
index can be reused by other virtio device. Signed-off-by: weiping zhang <zhangweip...@didichuxing.com> --- drivers/virtio/virtio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 48230a5..bf7ff39 100644 --- a/drivers/virtio/vi