[PATCH v2] virtio/vsock: fix the transport to work with VMADDR_CID_ANY

2021-11-25 Thread Wei Wang
quot;vsock: add multi-transports support") Signed-off-by: Wei Wang --- net/vmw_vsock/virtio_transport_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c index 59ee1be5a6dd..ec2c2afbf

[PATCH] virtio/vsock: fix the transport to work with VMADDR_CID_ANY

2021-11-25 Thread Wei Wang
client to connect to the host server: socat - VSOCK-CONNECT:1:1234 Without this patch, step 3. above fails to connect, and socat complains "socat[1720] E connect(5, AF=40 cid:1 port:1234, 16): Connection reset by peer". With this patch, the above works well. Signed-off-by: Wei Wang

Re: [PATCH] virtio_balloon: fix up endian-ness for free cmd id

2020-07-28 Thread Wei Wang
o_has_feature(vb->vdev, VIRTIO_F_VERSION_1)) + vb->cmd_id_received_cache = le32_to_cpu((__force __le32)vb->cmd_id_received_cache); Seems it exceeds 80 character length. Reviewed-by: Wei Wang Best, Wei ___ Virtualizat

[PATCH RFC] virtio_balloon: conservative balloon page shrinking

2020-02-06 Thread Wei Wang
There are cases that users want to shrink balloon pages after the pagecache depleted. The conservative_shrinker lets the shrinker shrink balloon pages when all the pagecache has been reclaimed. Signed-off-by: Wei Wang --- drivers/virtio/virtio_balloon.c | 14 +- 1 file changed, 13

Re: [PATCH 1/2] virtio-balloon: initialize all vq callbacks

2019-12-17 Thread Wei Wang
On 12/18/2019 01:19 PM, Michael S. Tsirkin wrote: On Wed, Dec 18, 2019 at 11:18:45AM +0800, Wei Wang wrote: On 12/18/2019 03:06 AM, Daniel Verkamp wrote: Ensure that elements of the array that correspond to unavailable features are set to NULL; previously, they would be left uninitialized

Re: [PATCH 1/2] virtio-balloon: initialize all vq callbacks

2019-12-17 Thread Wei Wang
On 12/18/2019 03:06 AM, Daniel Verkamp wrote: Ensure that elements of the array that correspond to unavailable features are set to NULL; previously, they would be left uninitialized. Since the corresponding names array elements were explicitly set to NULL, the uninitialized callback pointers

Re: [PATCH] virtio-balloon: request nvqs based on features

2019-12-16 Thread Wei Wang
On 12/17/2019 07:14 AM, Daniel Verkamp wrote: After 86a559787e6f ("virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT"), the virtio-balloon device unconditionally specifies 4 virtqueues as the argument to find_vqs(), which means that 5 MSI-X vectors are required in order to assign one vector per VQ

Re: VIRTIO_BALLOON_F_FREE_PAGE_HINT

2019-09-15 Thread Wei Wang
On 09/14/2019 02:36 AM, Tyler Sanderson wrote: Hello, I'm curious about the intent of VIRTIO_BALLOON_F_FREE_PAGE_HINT (commit ). My understanding is that this mechanism

Re: [PATCH v3 2/3] virtio-balloon: improve update_balloon_size_func

2019-01-16 Thread Wei Wang
On 01/15/2019 09:00 AM, Michael S. Tsirkin wrote: On Mon, Jan 07, 2019 at 03:01:05PM +0800, Wei Wang wrote: There is no need to update the balloon actual register when there is no ballooning request. This patch avoids update_balloon_size when diff is 0. Signed-off-by: Wei Wang Reviewed

Re: [virtio-dev] [PATCH 2/2] virtio: document virtio_config_ops restrictions

2019-01-16 Thread Wei Wang
/ + * @finalize_features are NOT safe to be called from an atomic + * context. * @get: read the value of a configuration field *vdev: the virtio_device *offset: the offset of the configuration field Reviewed-by: Wei Wang Best, Wei

Re: [PATCH 1/2] virtio: fix virtio_config_ops description

2019-01-16 Thread Wei Wang
); Ping. Any feedback on that patch? Reviewed-by: Wei Wang Best, Wei ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Re: [PATCH v3 1/3] virtio-balloon: tweak config_changed implementation

2019-01-09 Thread Wei Wang
On 01/08/2019 04:46 PM, Christian Borntraeger wrote: On 08.01.2019 06:35, Wei Wang wrote: On 01/07/2019 09:49 PM, Christian Borntraeger wrote: On 07.01.2019 08:01, Wei Wang wrote: virtio-ccw has deadlock issues with reading the config space inside the interrupt context, so we tweak

Re: [PATCH v3 1/3] virtio-balloon: tweak config_changed implementation

2019-01-07 Thread Wei Wang
On 01/07/2019 09:49 PM, Christian Borntraeger wrote: On 07.01.2019 08:01, Wei Wang wrote: virtio-ccw has deadlock issues with reading the config space inside the interrupt context, so we tweak the virtballoon_changed implementation by moving the config read operations into the related

[PATCH v4 3/3] virtio_balloon: remove the unnecessary 0-initialization

2019-01-07 Thread Wei Wang
We've changed to kzalloc the vb struct, so no need to 0-initialize this field one more time. Signed-off-by: Wei Wang Reviewed-by: Cornelia Huck --- drivers/virtio/virtio_balloon.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio

[PATCH v4 0/3] virtio-balloon: tweak config_changed

2019-01-07 Thread Wei Wang
since vb is allocated via kzalloc. v1->v2 ChangeLog: - add config_read_bitmap to indicate to the workqueue callbacks about the necessity of reading the related config fields. Wei Wang (3): virtio-balloon: tweak config_changed implementation virtio-balloon: improve update_ballo

[PATCH v4 2/3] virtio-balloon: improve update_balloon_size_func

2019-01-07 Thread Wei Wang
There is no need to update the balloon actual register when there is no ballooning request. This patch avoids update_balloon_size when diff is 0. Signed-off-by: Wei Wang Reviewed-by: Cornelia Huck Reviewed-by: Halil Pasic Tested-by: Christian Borntraeger --- drivers/virtio/virtio_balloon.c

[PATCH v4 1/3] virtio-balloon: tweak config_changed implementation

2019-01-07 Thread Wei Wang
the related config fields that need to be read. The cmd_id_received is also renamed to cmd_id_received_cache, and the value should be obtained via virtio_balloon_cmd_id_received. Fixes: 86a559787e6f ("virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT") Reported-by: Christian Borntraeger Signed-o

[PATCH v3 3/3] virtio_balloon: remove the unnecessary 0-initialization

2019-01-07 Thread Wei Wang
We've changed to kzalloc the vb struct, so no need to 0-initialize this field one more time. Signed-off-by: Wei Wang --- drivers/virtio/virtio_balloon.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index e33dc8e..f19061b

[PATCH v3 2/3] virtio-balloon: improve update_balloon_size_func

2019-01-07 Thread Wei Wang
There is no need to update the balloon actual register when there is no ballooning request. This patch avoids update_balloon_size when diff is 0. Signed-off-by: Wei Wang Reviewed-by: Cornelia Huck Reviewed-by: Halil Pasic --- drivers/virtio/virtio_balloon.c | 5 - 1 file changed, 4

[PATCH v3 0/3] virtio-balloon: tweak config_changed

2019-01-07 Thread Wei Wang
indicate to the workqueue callbacks about the necessity of reading the related config fields. Wei Wang (3): virtio-balloon: tweak config_changed implementation virtio-balloon: improve update_balloon_size_func virtio_balloon: remove the unnecessary 0-initialization drivers/virtio/virtio_

[PATCH v3 1/3] virtio-balloon: tweak config_changed implementation

2019-01-06 Thread Wei Wang
the related config fields that need to be read. The cmd_id_received is also renamed to cmd_id_received_cache, and the value should be obtained via virtio_balloon_cmd_id_received. Reported-by: Christian Borntraeger Signed-off-by: Wei Wang Reviewed-by: Cornelia Huck Reviewed-by: Halil Pasic --- drivers

[PATCH v2 2/2] virtio-balloon: improve update_balloon_size_func

2019-01-04 Thread Wei Wang
There is no need to update the balloon actual register when there is no ballooning request. This patch avoids update_balloon_size when diff is 0. Signed-off-by: Wei Wang Reviewed-by: Cornelia Huck Reviewed-by: Halil Pasic --- drivers/virtio/virtio_balloon.c | 5 - 1 file changed, 4

[PATCH v2 1/2] virtio-balloon: tweak config_changed implementation

2019-01-04 Thread Wei Wang
the related config fields that need to be read. Reported-by: Christian Borntraeger Signed-off-by: Wei Wang --- drivers/virtio/virtio_balloon.c | 81 +++-- 1 file changed, 53 insertions(+), 28 deletions(-) diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio

[PATCH v2 0/2] virtio-balloon: tweak config_changed

2019-01-03 Thread Wei Wang
out the necessity of reading the related config fields. Wei Wang (2): virtio-balloon: tweak config_changed implementation virtio-balloon: improve update_balloon_size_func drivers/virtio/virtio_balloon.c | 86 +++-- 1 file changed, 57 insertions(+),

Re: [virtio-dev] Re: [PATCH v1 1/2] virtio-balloon: tweak config_changed implementation

2019-01-03 Thread Wei Wang
On 01/04/2019 12:42 AM, Michael S. Tsirkin wrote: On Thu, Jan 03, 2019 at 01:31:01PM +0800, Wei Wang wrote: virtio-ccw has deadlock issues with reading config registers inside the interrupt context, so we tweak the virtballoon_changed implementation by moving the config read operations

Re: [PATCH v1 1/2] virtio-balloon: tweak config_changed implementation

2019-01-03 Thread Wei Wang
On 01/03/2019 05:40 PM, Cornelia Huck wrote: On Thu, 3 Jan 2019 13:31:01 +0800 Wei Wang wrote: virtio-ccw has deadlock issues with reading config registers inside the s/config registers/the config space/ ? Sounds good. interrupt context, so we tweak the virtballoon_changed

Re: [PATCH v1 0/2] Virtio: fix some vq allocation issues

2019-01-02 Thread Wei Wang
On 12/28/2018 03:57 PM, Christian Borntraeger wrote: On 28.12.2018 03:26, Wei Wang wrote: Some vqs don't need to be allocated when the related feature bits are disabled. Callers notice the vq allocation layer by setting the related names[i] to be NULL. This patch series fixes the find_vqs

[PATCH v1 2/2] virtio-balloon: improve update_balloon_size_func

2019-01-02 Thread Wei Wang
There is no need to update the balloon actual register when there is no ballooning request. This patch avoids update_balloon_size when diff is 0. Signed-off-by: Wei Wang --- drivers/virtio/virtio_balloon.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/virtio

[PATCH v1 1/2] virtio-balloon: tweak config_changed implementation

2019-01-02 Thread Wei Wang
virtio-ccw has deadlock issues with reading config registers inside the interrupt context, so we tweak the virtballoon_changed implementation by moving the config read operations into the related workqueue contexts. Signed-off-by: Wei Wang --- drivers/virtio/virtio_balloon.c | 54

[PATCH v1 0/2] virtio-balloon: tweak config_changed

2019-01-02 Thread Wei Wang
Since virtio-ccw doesn't work with accessing to the config registers inside an interrupt context, this patch series avoids that issue by moving the config register accesses to the related workqueue contexts. Wei Wang (2): virtio-balloon: tweak config_changed implementation virtio-balloon

Re: [PATCH v37 0/3] Virtio-balloon: support free page reporting

2018-12-27 Thread Wei Wang
On 12/27/2018 08:17 PM, Christian Borntraeger wrote: On 27.12.2018 12:59, Christian Borntraeger wrote: On 27.12.2018 12:31, Christian Borntraeger wrote: This patch triggers random crashes in the guest kernel on s390 early during boot. No migration and no setting of the balloon is involved.

Re: [PATCH v37 1/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT

2018-12-27 Thread Wei Wang
On 12/27/2018 08:03 PM, Christian Borntraeger wrote: On 27.08.2018 03:32, Wei Wang wrote: static int init_vqs(struct virtio_balloon *vb) { - struct virtqueue *vqs[3]; - vq_callback_t *callbacks[] = { balloon_ack, balloon_ack, stats_request }; - static const char * const

[PATCH v1 2/2] virtio: don't allocate vqs when names[i] = NULL

2018-12-27 Thread Wei Wang
Some vqs may not need to be allocated when their related feature bits are disabled. So callers may pass in such vqs with "names = NULL". Then we skip such vq allocations. Signed-off-by: Wei Wang --- drivers/misc/mic/vop/vop_main.c| 9 +++-- drivers/remoteproc/remotepro

[PATCH v1 1/2] virtio_pci: use queue idx instead of array idx to set up the vq

2018-12-27 Thread Wei Wang
to the 3rd queue on the device. So we use queue_idx as the queue index, which is increased only when the queue exists. Signed-off-by: Wei Wang --- drivers/virtio/virtio_pci_common.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/virtio/virtio_pci_common.c b/drivers

[PATCH v1 0/2] Virtio: fix some vq allocation issues

2018-12-27 Thread Wei Wang
Some vqs don't need to be allocated when the related feature bits are disabled. Callers notice the vq allocation layer by setting the related names[i] to be NULL. This patch series fixes the find_vqs implementations to handle this case. Wei Wang (2): virtio_pci: use queue idx instead of array

Re: [PATCH v37 0/3] Virtio-balloon: support free page reporting

2018-10-25 Thread Wei Wang
On 10/25/2018 08:58 AM, Michael S. Tsirkin wrote: On Mon, Aug 27, 2018 at 09:32:16AM +0800, Wei Wang wrote: The new feature, VIRTIO_BALLOON_F_FREE_PAGE_HINT, implemented by this series enables the virtio-balloon driver to report hints of guest free pages to host. It can be used to accelerate

Re: [PATCH v36 0/5] Virtio-balloon: support free page reporting

2018-09-06 Thread Wei Wang
On 07/23/2018 10:36 PM, Dr. David Alan Gilbert wrote: * Michael S. Tsirkin (m...@redhat.com) wrote: On Fri, Jul 20, 2018 at 04:33:00PM +0800, Wei Wang wrote: This patch series is separated from the previous "Virtio-balloon Enhancement" series. The new feature, VIRTIO_BALLOON_F_FREE

[PATCH v37 1/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT

2018-08-26 Thread Wei Wang
d pages". TODO: - Add a batch page allocation API to amortize the allocation overhead. Signed-off-by: Wei Wang Signed-off-by: Liang Li Cc: Michael S. Tsirkin Cc: Michal Hocko Cc: Andrew Morton Cc: Linus Torvalds --- drivers/virtio/virtio_balloon.c | 364 +

[PATCH v37 2/3] mm/page_poison: expose page_poisoning_enabled to kernel modules

2018-08-26 Thread Wei Wang
In some usages, e.g. virtio-balloon, a kernel module needs to know if page poisoning is in use. This patch exposes the page_poisoning_enabled function to kernel modules. Signed-off-by: Wei Wang Cc: Andrew Morton Cc: Michal Hocko Cc: Michael S. Tsirkin Acked-by: Andrew Morton --- mm

[PATCH v37 3/3] virtio-balloon: VIRTIO_BALLOON_F_PAGE_POISON

2018-08-26 Thread Wei Wang
The VIRTIO_BALLOON_F_PAGE_POISON feature bit is used to indicate if the guest is using page poisoning. Guest writes to the poison_val config field to tell host about the page poisoning value that is in use. Suggested-by: Michael S. Tsirkin Signed-off-by: Wei Wang Cc: Michael S. Tsirkin Cc

[PATCH v37 0/3] Virtio-balloon: support free page reporting

2018-08-26 Thread Wei Wang
a DONE cmd from host. Please see patch 1's commit log for reasons. Please see patch 1's commit for detailed explanations. For ChangeLogs from v22 to v36, please reference https://lkml.org/lkml/2018/7/20/199 For ChangeLogs before v21, please reference https://lwn.net/Articles/743660/ Wei Wang

[PATCH v4 3/3] virtio_balloon: replace oom notifier with shrinker

2018-08-16 Thread Wei Wang
torically, the feature VIRTIO_BALLOON_F_DEFLATE_ON_OOM has been used to release balloon pages on OOM. We continue to use this feature bit for the shrinker, so the shrinker is only registered when this feature bit has been negotiated with host. Signed-off-by: Wei Wang Cc: Michael S. Tsirkin Cc: Mic

[PATCH v4 2/3] virtio-balloon: kzalloc the vb struct

2018-08-16 Thread Wei Wang
Zero all the vb fields at alloaction, so that we don't need to zero-initialize each field one by one later. Signed-off-by: Wei Wang Cc: Michael S. Tsirkin Cc: Tetsuo Handa --- drivers/virtio/virtio_balloon.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers

[PATCH v4 1/3] virtio-balloon: remove BUG() in init_vqs

2018-08-16 Thread Wei Wang
It's a bit overkill to use BUG when failing to add an entry to the stats_vq in init_vqs. So remove it and just return the error to the caller to bail out nicely. Signed-off-by: Wei Wang Cc: Michael S. Tsirkin --- drivers/virtio/virtio_balloon.c | 10 +++--- 1 file changed, 7 insertions

[PATCH v4 0/3] virtio-balloon: some improvements

2018-08-16 Thread Wei Wang
batch = 0, which is not needed now. v2->v3: - shrink the balloon pages according to the amount requested by the claimer, instead of using a user specified number; v1->v2: - register the shrinker when VIRTIO_BALLOON_F_DEFLATE_ON_OOM is negotiated. Wei Wang (3): virtio-balloon: remove BUG() in ini

Re: [PATCH v3 2/2] virtio_balloon: replace oom notifier with shrinker

2018-08-06 Thread Wei Wang
On 08/03/2018 08:11 PM, Tetsuo Handa wrote: On 2018/08/03 17:32, Wei Wang wrote: +static int virtio_balloon_register_shrinker(struct virtio_balloon *vb) +{ + vb->shrinker.scan_objects = virtio_balloon_shrinker_scan; + vb->shrinker.count_objects = virtio_balloon_shrinker

Re: [PATCH v3 2/2] virtio_balloon: replace oom notifier with shrinker

2018-08-05 Thread Wei Wang
On 08/04/2018 03:15 AM, Michael S. Tsirkin wrote: On Fri, Aug 03, 2018 at 04:32:26PM +0800, Wei Wang wrote: The OOM notifier is getting deprecated to use for the reasons: - As a callout from the oom context, it is too subtle and easy to generate bugs and corner cases which are hard to track

[PATCH v3 2/2] virtio_balloon: replace oom notifier with shrinker

2018-08-03 Thread Wei Wang
torically, the feature VIRTIO_BALLOON_F_DEFLATE_ON_OOM has been used to release balloon pages on OOM. We continue to use this feature bit for the shrinker, so the shrinker is only registered when this feature bit has been negotiated with host. Signed-off-by: Wei Wang Cc: Michael S. Tsirkin Cc: Mic

[PATCH v3 0/2] virtio-balloon: some improvements

2018-08-03 Thread Wei Wang
he shrinker when VIRTIO_BALLOON_F_DEFLATE_ON_OOM is negotiated. Wei Wang (2): virtio-balloon: remove BUG() in init_vqs virtio_balloon: replace oom notifier with shrinker drivers/virtio/virtio_balloon.c | 121 ++-- 1 file changed, 67 insertions(+), 54 deletio

Re: [PATCH v2 2/2] virtio_balloon: replace oom notifier with shrinker

2018-08-02 Thread Wei Wang
On 08/02/2018 07:47 PM, Michal Hocko wrote: On Thu 02-08-18 18:32:44, Wei Wang wrote: On 08/01/2018 07:34 PM, Michal Hocko wrote: On Wed 01-08-18 19:12:25, Wei Wang wrote: On 07/30/2018 05:00 PM, Michal Hocko wrote: On Fri 27-07-18 17:24:55, Wei Wang wrote: The OOM notifier is getting

Re: [PATCH v2 2/2] virtio_balloon: replace oom notifier with shrinker

2018-08-02 Thread Wei Wang
On 08/02/2018 07:00 PM, Tetsuo Handa wrote: On 2018/08/02 19:32, Wei Wang wrote: On 08/01/2018 07:34 PM, Michal Hocko wrote: Do you have any numbers for how does this work in practice? It works in this way: for example, we can set the parameter, balloon_pages_to_shrink, to shrink 1GB memory

Re: [PATCH v2 2/2] virtio_balloon: replace oom notifier with shrinker

2018-08-02 Thread Wei Wang
On 08/01/2018 07:34 PM, Michal Hocko wrote: On Wed 01-08-18 19:12:25, Wei Wang wrote: On 07/30/2018 05:00 PM, Michal Hocko wrote: On Fri 27-07-18 17:24:55, Wei Wang wrote: The OOM notifier is getting deprecated to use for the reasons mentioned here by Michal Hocko: https://lkml.org/lkml/2018

Re: [PATCH v2 2/2] virtio_balloon: replace oom notifier with shrinker

2018-08-01 Thread Wei Wang
On 07/30/2018 05:00 PM, Michal Hocko wrote: On Fri 27-07-18 17:24:55, Wei Wang wrote: The OOM notifier is getting deprecated to use for the reasons mentioned here by Michal Hocko: https://lkml.org/lkml/2018/7/12/314 This patch replaces the virtio-balloon oom notifier with a shrinker to release

[PATCH v2 2/2] virtio_balloon: replace oom notifier with shrinker

2018-07-27 Thread Wei Wang
virtballoon_oom_notify that only VIRTIO_BALLOON_ARRAY_PFNS_MAX (i.e 256) balloon pages can be freed though the user has specified more than that number is fixed in the shrinker_scan function. Signed-off-by: Wei Wang Cc: Michael S. Tsirkin Cc: Michal Hocko Cc: Andrew Morton --- drivers/virtio/virtio_balloon.c

[PATCH v2 1/2] virtio-balloon: remove BUG() in init_vqs

2018-07-27 Thread Wei Wang
It's a bit overkill to use BUG when failing to add an entry to the stats_vq in init_vqs. So remove it and just return the error to the caller to bail out nicely. Signed-off-by: Wei Wang Cc: Michael S. Tsirkin --- drivers/virtio/virtio_balloon.c | 10 +++--- 1 file changed, 7 insertions

[PATCH v2 0/2] virtio-balloon: some improvements

2018-07-27 Thread Wei Wang
This series is split from the "Virtio-balloon: support free page reporting" series to make some improvements. v1->v2 ChangeLog: - register the shrinker when VIRTIO_BALLOON_F_DEFLATE_ON_OOM is negotiated. Wei Wang (2): virtio-balloon: remove BUG() in init_vqs virtio_balloon

Re: [PATCH v36 0/5] Virtio-balloon: support free page reporting

2018-07-24 Thread Wei Wang
On 07/23/2018 10:36 PM, Dr. David Alan Gilbert wrote: * Michael S. Tsirkin (m...@redhat.com) wrote: On Fri, Jul 20, 2018 at 04:33:00PM +0800, Wei Wang wrote: This patch series is separated from the previous "Virtio-balloon Enhancement" series. The new feature, VIRTIO_BALLOON_F_FREE

Re: [PATCH v36 2/5] virtio_balloon: replace oom notifier with shrinker

2018-07-23 Thread Wei Wang
On 07/23/2018 10:13 PM, Michael S. Tsirkin wrote: vb->vb_dev_info.inode->i_mapping->a_ops = _aops; #endif + err = virtio_balloon_register_shrinker(vb); + if (err) + goto out_del_vqs; So we can get scans before device is ready. Leak will fail then. Why not

Re: [PATCH v36 2/5] virtio_balloon: replace oom notifier with shrinker

2018-07-23 Thread Wei Wang
On 07/22/2018 10:48 PM, Michael S. Tsirkin wrote: On Fri, Jul 20, 2018 at 04:33:02PM +0800, Wei Wang wrote: +static unsigned long virtio_balloon_shrinker_scan(struct shrinker *shrinker, + struct shrink_control *sc) +{ + unsigned long

[PATCH v36 3/5] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT

2018-07-20 Thread Wei Wang
page vq, which acks to host the cmd id received. When the guest finishes reporting free pages, a stop cmd is sent to host via the vq. TODO: - Add a batch page allocation API to amortize the allocation overhead. Signed-off-by: Wei Wang Signed-off-by: Liang Li Cc: Michael S. Tsirkin Cc: Michal

[PATCH v36 5/5] virtio-balloon: VIRTIO_BALLOON_F_PAGE_POISON

2018-07-20 Thread Wei Wang
The VIRTIO_BALLOON_F_PAGE_POISON feature bit is used to indicate if the guest is using page poisoning. Guest writes to the poison_val config field to tell host about the page poisoning value that is in use. Suggested-by: Michael S. Tsirkin Signed-off-by: Wei Wang Cc: Michael S. Tsirkin Cc

[PATCH v36 4/5] mm/page_poison: expose page_poisoning_enabled to kernel modules

2018-07-20 Thread Wei Wang
In some usages, e.g. virtio-balloon, a kernel module needs to know if page poisoning is in use. This patch exposes the page_poisoning_enabled function to kernel modules. Signed-off-by: Wei Wang Cc: Andrew Morton Cc: Michal Hocko Cc: Michael S. Tsirkin Acked-by: Andrew Morton --- mm

[PATCH v36 1/5] virtio-balloon: remove BUG() in init_vqs

2018-07-20 Thread Wei Wang
It's a bit overkill to use BUG when failing to add an entry to the stats_vq in init_vqs. So remove it and just return the error to the caller to bail out nicely. Signed-off-by: Wei Wang Cc: Michael S. Tsirkin --- drivers/virtio/virtio_balloon.c | 10 +++--- 1 file changed, 7 insertions

[PATCH v36 2/5] virtio_balloon: replace oom notifier with shrinker

2018-07-20 Thread Wei Wang
virtballoon_oom_notify that only VIRTIO_BALLOON_ARRAY_PFNS_MAX (i.e 256) balloon pages can be freed though the user has specified more than that number is fixed in the shrinker_scan function. Signed-off-by: Wei Wang Cc: Michael S. Tsirkin Cc: Michal Hocko Cc: Andrew Morton Cc: Linus Torvalds --- drivers

[PATCH v36 0/5] Virtio-balloon: support free page reporting

2018-07-20 Thread Wei Wang
59413/ For ChangeLogs before v21, please reference https://lwn.net/Articles/743660/ Wei Wang (5): virtio-balloon: remove BUG() in init_vqs virtio_balloon: replace oom notifier with shrinker virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT mm/page_poison: expose page_poisoning_enabled to kernel mo

Re: [PATCH v35 1/5] mm: support to get hints of free page blocks

2018-07-12 Thread Wei Wang
On 07/12/2018 07:49 PM, Michal Hocko wrote: On Thu 12-07-18 19:34:16, Wei Wang wrote: On 07/12/2018 04:13 PM, Michal Hocko wrote: On Thu 12-07-18 10:52:08, Wei Wang wrote: On 07/12/2018 10:30 AM, Linus Torvalds wrote: On Wed, Jul 11, 2018 at 7:17 PM Wei Wang wrote: Would it be better

Re: [PATCH v35 1/5] mm: support to get hints of free page blocks

2018-07-11 Thread Wei Wang
On 07/12/2018 10:30 AM, Linus Torvalds wrote: On Wed, Jul 11, 2018 at 7:17 PM Wei Wang wrote: Would it be better to remove __GFP_THISNODE? We actually want to get all the guest free pages (from all the nodes). Maybe. Or maybe it would be better to have the memory balloon logic be per-node

Re: [PATCH v35 1/5] mm: support to get hints of free page blocks

2018-07-11 Thread Wei Wang
On 07/12/2018 12:23 AM, Linus Torvalds wrote: On Wed, Jul 11, 2018 at 2:21 AM Michal Hocko wrote: We already have an interface for that. alloc_pages(GFP_NOWAIT, MAX_ORDER -1). So why do we need any array based interface? That was actually my original argument in the original thread - that the

Re: [PATCH v35 1/5] mm: support to get hints of free page blocks

2018-07-11 Thread Wei Wang
On 07/11/2018 05:21 PM, Michal Hocko wrote: On Tue 10-07-18 18:44:34, Linus Torvalds wrote: [...] That was what I tried to encourage with actually removing the pages form the page list. That would be an _incremental_ interface. You can remove MAX_ORDER-1 pages one by one (or a hundred at a

[PATCH v35 4/5] mm/page_poison: expose page_poisoning_enabled to kernel modules

2018-07-10 Thread Wei Wang
In some usages, e.g. virtio-balloon, a kernel module needs to know if page poisoning is in use. This patch exposes the page_poisoning_enabled function to kernel modules. Signed-off-by: Wei Wang Cc: Andrew Morton Cc: Michal Hocko Cc: Michael S. Tsirkin Acked-by: Andrew Morton --- mm

[PATCH v35 5/5] virtio-balloon: VIRTIO_BALLOON_F_PAGE_POISON

2018-07-10 Thread Wei Wang
The VIRTIO_BALLOON_F_PAGE_POISON feature bit is used to indicate if the guest is using page poisoning. Guest writes to the poison_val config field to tell host about the page poisoning value that is in use. Suggested-by: Michael S. Tsirkin Signed-off-by: Wei Wang Cc: Michael S. Tsirkin Cc

[PATCH v35 3/5] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT

2018-07-10 Thread Wei Wang
-by: Wei Wang Signed-off-by: Liang Li Cc: Michael S. Tsirkin Cc: Michal Hocko Cc: Andrew Morton --- drivers/virtio/virtio_balloon.c | 399 +--- include/uapi/linux/virtio_balloon.h | 11 + 2 files changed, 384 insertions(+), 26 deletions(-) diff --git

[PATCH v35 2/5] virtio-balloon: remove BUG() in init_vqs

2018-07-10 Thread Wei Wang
It's a bit overkill to use BUG when failing to add an entry to the stats_vq in init_vqs. So remove it and just return the error to the caller to bail out nicely. Signed-off-by: Wei Wang Cc: Michael S. Tsirkin --- drivers/virtio/virtio_balloon.c | 10 +++--- 1 file changed, 7 insertions

[PATCH v35 1/5] mm: support to get hints of free page blocks

2018-07-10 Thread Wei Wang
, those pages that are hinted as free pages but are written after this function returns will be captured by the hypervisor, and they will be added to the next round of memory transfer. Suggested-by: Linus Torvalds Signed-off-by: Wei Wang Signed-off-by: Liang Li Cc: Michal Hocko Cc: Andrew Morton

[PATCH v35 0/5] Virtio-balloon: support free page reporting

2018-07-10 Thread Wei Wang
iables on stack to have simpler implementation; - add destroy_workqueue(vb->balloon_wq); v21->v22: - add_one_sg: some code and comment re-arrangement - send_cmd_id: handle a cornercase For previous ChangeLog, please reference https://lwn.net/Articles/743660/ Wei Wan

Re: [PATCH v34 0/4] Virtio-balloon: support free page reporting

2018-06-29 Thread Wei Wang
On 06/25/2018 08:05 PM, Wei Wang wrote: This patch series is separated from the previous "Virtio-balloon Enhancement" series. The new feature, VIRTIO_BALLOON_F_FREE_PAGE_HINT, implemented by this series enables the virtio-balloon driver to report hints of guest free pages to the ho

Re: [PATCH v34 0/4] Virtio-balloon: support free page reporting

2018-06-29 Thread Wei Wang
On 06/29/2018 03:46 PM, David Hildenbrand wrote: I'm afraid it can't. For example, when we have a guest booted, without too many memory activities. Assume the guest has 8GB free memory. The arch_free_page there won't be able to capture the 8GB free pages since there is no free() called. This

Re: [PATCH v34 0/4] Virtio-balloon: support free page reporting

2018-06-28 Thread Wei Wang
On 06/27/2018 07:06 PM, David Hildenbrand wrote: On 25.06.2018 14:05, Wei Wang wrote: This patch series is separated from the previous "Virtio-balloon Enhancement" series. The new feature, VIRTIO_BALLOON_F_FREE_PAGE_HINT, implemented by this series enables the virtio-balloon driver

Re: [PATCH v33 1/4] mm: add a function to get free page blocks

2018-06-28 Thread Wei Wang
On 06/28/2018 03:07 AM, Michael S. Tsirkin wrote: On Wed, Jun 27, 2018 at 09:05:39AM -0700, Linus Torvalds wrote: [ Sorry for slow reply, my travels have made a mess of my inbox ] On Mon, Jun 25, 2018 at 6:55 PM Michael S. Tsirkin wrote: Linus, do you think it would be ok to have

Re: [PATCH v34 2/4] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT

2018-06-26 Thread Wei Wang
On 06/27/2018 11:58 AM, Michael S. Tsirkin wrote: On Wed, Jun 27, 2018 at 11:00:05AM +0800, Wei Wang wrote: On 06/27/2018 10:41 AM, Michael S. Tsirkin wrote: On Wed, Jun 27, 2018 at 09:24:18AM +0800, Wei Wang wrote: On 06/26/2018 09:34 PM, Michael S. Tsirkin wrote: On Tue, Jun 26, 2018 at 08

Re: [PATCH v34 2/4] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT

2018-06-26 Thread Wei Wang
On 06/27/2018 10:41 AM, Michael S. Tsirkin wrote: On Wed, Jun 27, 2018 at 09:24:18AM +0800, Wei Wang wrote: On 06/26/2018 09:34 PM, Michael S. Tsirkin wrote: On Tue, Jun 26, 2018 at 08:27:44PM +0800, Wei Wang wrote: On 06/26/2018 11:56 AM, Michael S. Tsirkin wrote: On Tue, Jun 26, 2018 at 11

Re: [PATCH v34 2/4] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT

2018-06-26 Thread Wei Wang
On 06/26/2018 09:34 PM, Michael S. Tsirkin wrote: On Tue, Jun 26, 2018 at 08:27:44PM +0800, Wei Wang wrote: On 06/26/2018 11:56 AM, Michael S. Tsirkin wrote: On Tue, Jun 26, 2018 at 11:46:35AM +0800, Wei Wang wrote: + if (!arrays) + return NULL; + + for (i = 0; i

Re: [PATCH v34 2/4] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT

2018-06-26 Thread Wei Wang
On 06/26/2018 11:56 AM, Michael S. Tsirkin wrote: On Tue, Jun 26, 2018 at 11:46:35AM +0800, Wei Wang wrote: + if (!arrays) + return NULL; + + for (i = 0; i < max_array_num; i++) { So we are getting a ton of memory here just to free it up a bit later.

Re: [PATCH v34 2/4] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT

2018-06-25 Thread Wei Wang
On 06/26/2018 09:37 AM, Michael S. Tsirkin wrote: On Mon, Jun 25, 2018 at 08:05:10PM +0800, Wei Wang wrote: @@ -326,17 +353,6 @@ static void stats_handle_request(struct virtio_balloon *vb) virtqueue_kick(vq); } -static void virtballoon_changed(struct virtio_device *vdev

[PATCH v34 4/4] virtio-balloon: VIRTIO_BALLOON_F_PAGE_POISON

2018-06-25 Thread Wei Wang
The VIRTIO_BALLOON_F_PAGE_POISON feature bit is used to indicate if the guest is using page poisoning. Guest writes to the poison_val config field to tell host about the page poisoning value that is in use. Suggested-by: Michael S. Tsirkin Signed-off-by: Wei Wang Cc: Michael S. Tsirkin Cc

[PATCH v34 3/4] mm/page_poison: expose page_poisoning_enabled to kernel modules

2018-06-25 Thread Wei Wang
In some usages, e.g. virtio-balloon, a kernel module needs to know if page poisoning is in use. This patch exposes the page_poisoning_enabled function to kernel modules. Signed-off-by: Wei Wang Cc: Andrew Morton Cc: Michal Hocko Cc: Michael S. Tsirkin Acked-by: Andrew Morton --- mm

[PATCH v34 2/4] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT

2018-06-25 Thread Wei Wang
-by: Wei Wang Signed-off-by: Liang Li Cc: Michael S. Tsirkin Cc: Michal Hocko Cc: Andrew Morton --- drivers/virtio/virtio_balloon.c | 347 include/uapi/linux/virtio_balloon.h | 11 ++ 2 files changed, 322 insertions(+), 36 deletions(-) diff --git

[PATCH v34 1/4] mm: support to get hints of free page blocks

2018-06-25 Thread Wei Wang
pages that are hinted as free pages but are written after this function returns will be captured by the hypervisor, and they will be added to the next round of memory transfer. Suggested-by: Linus Torvalds Signed-off-by: Wei Wang Signed-off-by: Liang Li Cc: Michal Hocko Cc: Andrew Morton Cc

[PATCH v34 0/4] Virtio-balloon: support free page reporting

2018-06-25 Thread Wei Wang
ueue(vb->balloon_wq); v21->v22: - add_one_sg: some code and comment re-arrangement - send_cmd_id: handle a cornercase For previous ChangeLog, please reference https://lwn.net/Articles/743660/ Wei Wang (4): mm: support to get hints of free page blocks virtio-balloon: VIRT

Re: [virtio-dev] Re: [PATCH v33 2/4] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT

2018-06-19 Thread Wei Wang
On 06/19/2018 11:05 AM, Michael S. Tsirkin wrote: On Tue, Jun 19, 2018 at 01:06:48AM +, Wang, Wei W wrote: On Monday, June 18, 2018 10:29 AM, Michael S. Tsirkin wrote: On Sat, Jun 16, 2018 at 01:09:44AM +, Wang, Wei W wrote: Not necessarily, I think. We have min(4m_page_blocks / 512,

[PATCH v33 4/4] virtio-balloon: VIRTIO_BALLOON_F_PAGE_POISON

2018-06-14 Thread Wei Wang
The VIRTIO_BALLOON_F_PAGE_POISON feature bit is used to indicate if the guest is using page poisoning. Guest writes to the poison_val config field to tell host about the page poisoning value that is in use. Suggested-by: Michael S. Tsirkin Signed-off-by: Wei Wang Cc: Michael S. Tsirkin Cc

[PATCH v33 3/4] mm/page_poison: expose page_poisoning_enabled to kernel modules

2018-06-14 Thread Wei Wang
In some usages, e.g. virtio-balloon, a kernel module needs to know if page poisoning is in use. This patch exposes the page_poisoning_enabled function to kernel modules. Signed-off-by: Wei Wang Cc: Andrew Morton Cc: Michal Hocko Cc: Michael S. Tsirkin Acked-by: Andrew Morton --- mm

[PATCH v33 2/4] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT

2018-06-14 Thread Wei Wang
free page lists when there is a need/request from users. Signed-off-by: Wei Wang Signed-off-by: Liang Li Cc: Michael S. Tsirkin Cc: Michal Hocko Cc: Andrew Morton --- drivers/virtio/virtio_balloon.c | 187 +--- include/uapi/linux/virtio_balloon.h | 13

[PATCH v33 1/4] mm: add a function to get free page blocks

2018-06-14 Thread Wei Wang
will be captured by the hypervisor, and they will be added to the next round of memory transfer. Suggested-by: Linus Torvalds Signed-off-by: Wei Wang Signed-off-by: Liang Li Cc: Michal Hocko Cc: Andrew Morton Cc: Michael S. Tsirkin Cc: Linus Torvalds --- include/linux/mm.h | 1 + mm

[PATCH v33 0/4] Virtio-balloon: support free page reporting

2018-06-14 Thread Wei Wang
some code and comment re-arrangement - send_cmd_id: handle a cornercase For previous ChangeLog, please reference https://lwn.net/Articles/743660/ Wei Wang (4): mm: add a function to get free page blocks virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT mm/page_poison: expose page_poisoning

Re: [PULL] vhost: cleanups and fixes

2018-06-14 Thread Wei Wang
On 06/14/2018 11:01 PM, Nitesh Narayan Lal wrote: Hi Wei, On 06/12/2018 07:05 AM, Wei Wang wrote: On 06/12/2018 09:59 AM, Linus Torvalds wrote: On Mon, Jun 11, 2018 at 6:36 PM Michael S. Tsirkin wrote: Maybe it will help to have GFP_NONE which will make any allocation fail if attempted

Re: [PULL] vhost: cleanups and fixes

2018-06-12 Thread Wei Wang
On 06/12/2018 09:59 AM, Linus Torvalds wrote: On Mon, Jun 11, 2018 at 6:36 PM Michael S. Tsirkin wrote: Maybe it will help to have GFP_NONE which will make any allocation fail if attempted. Linus, would this address your comment? It would definitely have helped me initially overlook that call

Re: [PATCH v29 1/4] mm: support reporting free page blocks

2018-04-10 Thread Wei Wang
On 04/11/2018 07:25 AM, Michael S. Tsirkin wrote: On Tue, Apr 10, 2018 at 01:54:29PM -0700, Andrew Morton wrote: On Tue, 10 Apr 2018 21:19:31 +0300 "Michael S. Tsirkin" wrote: Andrew, were your questions answered? If yes could I bother you for an ack on this? Still not

[PATCH v32 1/4] mm: support reporting free page blocks

2018-04-09 Thread Wei Wang
ges but are written after the report function returns will be captured by the hypervisor, and they will be added to the next round of memory transfer. Signed-off-by: Wei Wang <wei.w.w...@intel.com> Signed-off-by: Liang Li <liang.z...@intel.com> Cc: Michal Hocko <mho...@kernel.org&

[PATCH v32 0/4] Virtio-balloon: support free page reporting

2018-04-09 Thread Wei Wang
stack to have simpler implementation; - add destroy_workqueue(vb->balloon_wq); v21->v22: - add_one_sg: some code and comment re-arrangement - send_cmd_id: handle a cornercase For previous ChangeLog, please reference https://lwn.net/Articles/743660/ Wei Wang (4): mm: suppo

  1   2   3   4   5   >