From: "Xia, Chenbo" <chenbo.xia@intel.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>,
"dev@dpdk.org" <dev@dpdk.org>, "mkp@redhat.com" <mkp@redhat.com>,
"david.marchand@redhat.com" <david.marchand@redhat.com>
Subject: RE: [PATCH v2] vhost: fix madvise IOTLB entries pages overlap check
Date: Thu, 16 Mar 2023 01:57:17 +0000 [thread overview]
Message-ID: <SN6PR11MB3504B1DC446FDED2C69B615A9CBC9@SN6PR11MB3504.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20230315114010.444005-1-maxime.coquelin@redhat.com>
> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Wednesday, March 15, 2023 7:40 PM
> To: dev@dpdk.org; mkp@redhat.com; Xia, Chenbo <chenbo.xia@intel.com>;
> david.marchand@redhat.com
> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
> Subject: [PATCH v2] vhost: fix madvise IOTLB entries pages overlap check
>
> At removal time, when testing whether the IOTLB entry has
> shared pages with the previous and next entries in the
> cache, it checks whether the start address of the entry to
> be removed is on the same page as the start address of the
> next entry in the cache.
>
> This is not correct, as an entry could cover several page
> so the end address of the entry to be remove should be
> used. This patch address this issue.
>
> Fixes: dea092d0addb ("vhost: fix madvise arguments alignment")
>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
> lib/vhost/iotlb.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/lib/vhost/iotlb.c b/lib/vhost/iotlb.c
> index 11785392ac..3f45bc6061 100644
> --- a/lib/vhost/iotlb.c
> +++ b/lib/vhost/iotlb.c
> @@ -182,8 +182,8 @@ vhost_user_iotlb_cache_random_evict(struct virtio_net
> *dev, struct vhost_virtque
> (node->uaddr & mask) != (prev_node->uaddr &
> mask)) {
> next_node = RTE_TAILQ_NEXT(node, next);
> /* Don't disable coredump if the next node is in
> the same page */
> - if (next_node == NULL ||
> - (node->uaddr & mask) != (next_node-
> >uaddr & mask))
> + if (next_node == NULL || ((node->uaddr + node-
> >size - 1) & mask) !=
> + (next_node->uaddr & mask))
> mem_set_dump((void *)(uintptr_t)node->uaddr,
> node->size,
> false, alignment);
> }
> @@ -287,8 +287,8 @@ vhost_user_iotlb_cache_remove(struct virtio_net *dev,
> struct vhost_virtqueue *vq
> (node->uaddr & mask) != (prev_node->uaddr &
> mask)) {
> next_node = RTE_TAILQ_NEXT(node, next);
> /* Don't disable coredump if the next node is in
> the same page */
> - if (next_node == NULL ||
> - (node->uaddr & mask) != (next_node-
> >uaddr & mask))
> + if (next_node == NULL || ((node->uaddr + node-
> >size - 1) & mask) !=
> + (next_node->uaddr & mask))
> mem_set_dump((void *)(uintptr_t)node->uaddr,
> node->size,
> false, alignment);
> }
> --
> 2.39.2
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
next prev parent reply other threads:[~2023-03-16 1:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-15 11:40 Maxime Coquelin
2023-03-16 1:57 ` Xia, Chenbo [this message]
2023-03-16 8:13 ` David Marchand
2023-03-16 8:38 ` Maxime Coquelin
2023-03-16 8:52 ` David Marchand
2023-03-16 14:45 ` Maxime Coquelin
2023-03-16 14:45 ` Maxime Coquelin
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=SN6PR11MB3504B1DC446FDED2C69B615A9CBC9@SN6PR11MB3504.namprd11.prod.outlook.com \
--to=chenbo.xia@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=maxime.coquelin@redhat.com \
--cc=mkp@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).