All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Hui Zhu <teawater@gmail.com>,
	mst@redhat.com, jasowang@redhat.com,
	virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org
Cc: Hui Zhu <teawaterz@linux.alibaba.com>
Subject: Re: [RFC] virtio-mem: virtio_mem_init: Access bb_size just in BBM mode
Date: Tue, 15 Jun 2021 09:43:33 +0200	[thread overview]
Message-ID: <7fd8bf39-642d-1cdf-bc5d-c19630045013@redhat.com> (raw)
In-Reply-To: <20210615065948.23493-1-teawater@gmail.com>

On 15.06.21 08:59, Hui Zhu wrote:
> From: Hui Zhu <teawaterz@linux.alibaba.com>
> 
> /* In BBM, we also want at least two big blocks. */
> vm->offline_threshold = max_t(uint64_t, 2 * vm->bbm.bb_size,
> 			      vm->offline_threshold);
> This line does not modify vm->offline_threshold depending on the data in
> vm->sbm that shares this address is 0 in SBM mode.
> I think it might be difficult to make sure when we change this in the
> future.
> 
> This commit adds an if to make sure that this line just be executed in
> BBM mode.
> 
> Signed-off-by: Hui Zhu <teawaterz@linux.alibaba.com>
> ---
>   drivers/virtio/virtio_mem.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c
> index 10ec60d..8185916 100644
> --- a/drivers/virtio/virtio_mem.c
> +++ b/drivers/virtio/virtio_mem.c
> @@ -2472,8 +2472,9 @@ static int virtio_mem_init(struct virtio_mem *vm)
>   	vm->offline_threshold = max_t(uint64_t, 2 * memory_block_size_bytes(),
>   				      VIRTIO_MEM_DEFAULT_OFFLINE_THRESHOLD);
>   	/* In BBM, we also want at least two big blocks. */
> -	vm->offline_threshold = max_t(uint64_t, 2 * vm->bbm.bb_size,
> -				      vm->offline_threshold);
> +	if (!vm->in_sbm)
> +		vm->offline_threshold = max_t(uint64_t, 2 * vm->bbm.bb_size,
> +					      vm->offline_threshold);
>   
>   	dev_info(&vm->vdev->dev, "start address: 0x%llx", vm->addr);
>   	dev_info(&vm->vdev->dev, "region size: 0x%llx", vm->region_size);
> 

Good that you also spotted it, I already have a fix pending for that :)

https://lkml.kernel.org/r/20210602185720.31821-2-david@redhat.com

-- 
Thanks,

David / dhildenb


WARNING: multiple messages have this Message-ID (diff)
From: David Hildenbrand <david@redhat.com>
To: Hui Zhu <teawater@gmail.com>,
	mst@redhat.com, jasowang@redhat.com,
	virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org
Cc: Hui Zhu <teawaterz@linux.alibaba.com>
Subject: Re: [RFC] virtio-mem: virtio_mem_init: Access bb_size just in BBM mode
Date: Tue, 15 Jun 2021 09:43:33 +0200	[thread overview]
Message-ID: <7fd8bf39-642d-1cdf-bc5d-c19630045013@redhat.com> (raw)
In-Reply-To: <20210615065948.23493-1-teawater@gmail.com>

On 15.06.21 08:59, Hui Zhu wrote:
> From: Hui Zhu <teawaterz@linux.alibaba.com>
> 
> /* In BBM, we also want at least two big blocks. */
> vm->offline_threshold = max_t(uint64_t, 2 * vm->bbm.bb_size,
> 			      vm->offline_threshold);
> This line does not modify vm->offline_threshold depending on the data in
> vm->sbm that shares this address is 0 in SBM mode.
> I think it might be difficult to make sure when we change this in the
> future.
> 
> This commit adds an if to make sure that this line just be executed in
> BBM mode.
> 
> Signed-off-by: Hui Zhu <teawaterz@linux.alibaba.com>
> ---
>   drivers/virtio/virtio_mem.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c
> index 10ec60d..8185916 100644
> --- a/drivers/virtio/virtio_mem.c
> +++ b/drivers/virtio/virtio_mem.c
> @@ -2472,8 +2472,9 @@ static int virtio_mem_init(struct virtio_mem *vm)
>   	vm->offline_threshold = max_t(uint64_t, 2 * memory_block_size_bytes(),
>   				      VIRTIO_MEM_DEFAULT_OFFLINE_THRESHOLD);
>   	/* In BBM, we also want at least two big blocks. */
> -	vm->offline_threshold = max_t(uint64_t, 2 * vm->bbm.bb_size,
> -				      vm->offline_threshold);
> +	if (!vm->in_sbm)
> +		vm->offline_threshold = max_t(uint64_t, 2 * vm->bbm.bb_size,
> +					      vm->offline_threshold);
>   
>   	dev_info(&vm->vdev->dev, "start address: 0x%llx", vm->addr);
>   	dev_info(&vm->vdev->dev, "region size: 0x%llx", vm->region_size);
> 

Good that you also spotted it, I already have a fix pending for that :)

https://lkml.kernel.org/r/20210602185720.31821-2-david@redhat.com

-- 
Thanks,

David / dhildenb

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  reply	other threads:[~2021-06-15  7:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-15  6:59 [RFC] virtio-mem: virtio_mem_init: Access bb_size just in BBM mode Hui Zhu
2021-06-15  7:43 ` David Hildenbrand [this message]
2021-06-15  7:43   ` David Hildenbrand
2021-06-15  7:57   ` teawater

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7fd8bf39-642d-1cdf-bc5d-c19630045013@redhat.com \
    --to=david@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=teawater@gmail.com \
    --cc=teawaterz@linux.alibaba.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.