From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1E90142970; Mon, 17 Apr 2023 21:16:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8522142B8C; Mon, 17 Apr 2023 21:16:10 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 1CE3C40698 for ; Mon, 17 Apr 2023 21:16:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681758968; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rH1IpBSi9KhdFwnjPuVVT9mVO61mUIBuE6Qd6VmYgFk=; b=JKXeiMEKZnY2lqRuWQcSY4XxRksZ9QaGJqJGj7wk3F+aWVYhmNq/gmbsDzrgSkPoBFN9QF 3ybvWU6HHqniVFBCdc+ZvUHC6X0tmEw2PNfBE/5vVHhCMzvWYeHBwP0/UkxnWDNBRhmGKg j1zIws5yMYwMaiV2p56pza70H8jbGAg= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-237-3Rf7lDPvOmayEankNfI-qQ-1; Mon, 17 Apr 2023 15:16:06 -0400 X-MC-Unique: 3Rf7lDPvOmayEankNfI-qQ-1 Received: by mail-ej1-f72.google.com with SMTP id ud12-20020a170907c60c00b0093c44a07ad1so9074795ejc.2 for ; Mon, 17 Apr 2023 12:16:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681758965; x=1684350965; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rH1IpBSi9KhdFwnjPuVVT9mVO61mUIBuE6Qd6VmYgFk=; b=RqlZf2T7V8VtNAbrNSo7Fu5+RaWj3dibW1ouC6G/aAoVFhq88YRnIwTjB3ATjObFh0 oKVXvXen0xRAq+BQgwtp0IPfI6BQulB1OSSHq55UQoaiGTINTjxxCsrUvvG/ntiYj7LU 2Ax5MpH4YHkh8C17n8lhmPiQ5Cq2uqfHJVjG2QrWTkiTg/aZ2SjplmCmT2FPZolyMu7/ dLfm7pzLLDZYeWyYe2pBmD6xVRXdzfU14HLcWONkIWH247tC9pNj683WIveeyE2LH3e8 RUVKNUJ5uSUArYU9l3lvKeJwmhpSoy8g8a4t52YIvX1Yzl90nOX976reZehQw3R70CTQ Aakw== X-Gm-Message-State: AAQBX9dCCeeeCEIFtpIQjbwlvyjoWMyWHws3HFGLCkp8CuTM/uDUcFCh 04xEHo6lmHpt9xF4f+SWkdLfGNYHnR20Nf+CfhBOdPOpnhrQyRbPfZVjRF7AuMrUbWwAtWDsMDh pO5EwDavvK2cFCV2ggiQ= X-Received: by 2002:a17:907:90c4:b0:94a:62d4:91b8 with SMTP id gk4-20020a17090790c400b0094a62d491b8mr7433299ejb.11.1681758965671; Mon, 17 Apr 2023 12:16:05 -0700 (PDT) X-Google-Smtp-Source: AKy350aT2tmamjbVSbe1VJ1P8NDTlZzw9gq45ZSDzwjxs1coVAM2DcMcshptN1QGkA8fE3J/+b1tfWmW489hWcbdvC4= X-Received: by 2002:a17:907:90c4:b0:94a:62d4:91b8 with SMTP id gk4-20020a17090790c400b0094a62d491b8mr7433282ejb.11.1681758965361; Mon, 17 Apr 2023 12:16:05 -0700 (PDT) MIME-Version: 1.0 References: <20230331154259.1447831-1-maxime.coquelin@redhat.com> <20230331154259.1447831-4-maxime.coquelin@redhat.com> In-Reply-To: <20230331154259.1447831-4-maxime.coquelin@redhat.com> From: Mike Pattrick Date: Mon, 17 Apr 2023 15:15:54 -0400 Message-ID: Subject: Re: [RFC 03/27] vhost: fix IOTLB entries overlap check with previous entry To: Maxime Coquelin Cc: dev@dpdk.org, david.marchand@redhat.com, chenbo.xia@intel.com, fbl@redhat.com, jasowang@redhat.com, cunming.liang@intel.com, xieyongji@bytedance.com, echaudro@redhat.com, eperezma@redhat.com, amorenoz@redhat.com, stable@dpdk.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Fri, Mar 31, 2023 at 11:43=E2=80=AFAM Maxime Coquelin wrote: > > Commit 22b6d0ac691a ("vhost: fix madvise IOTLB entries pages overlap chec= k") > fixed the check to ensure the entry to be removed does not > overlap with the next one in the IOTLB cache before marking > it as DONTDUMP with madvise(). This is not enough, because > the same issue is present when comparing with the previous > entry in the cache, where the end address of the previous > entry should be used, not the start one. > > Fixes: dea092d0addb ("vhost: fix madvise arguments alignment") > Cc: stable@dpdk.org > > Signed-off-by: Maxime Coquelin Hi Maxime, This makes sense. Acked-by: Mike Pattrick > --- > 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 3f45bc6061..870c8acb88 100644 > --- a/lib/vhost/iotlb.c > +++ b/lib/vhost/iotlb.c > @@ -178,8 +178,8 @@ vhost_user_iotlb_cache_random_evict(struct virtio_net= *dev, struct vhost_virtque > mask =3D ~(alignment - 1); > > /* Don't disable coredump if the previous node is= in the same page */ > - if (prev_node =3D=3D NULL || > - (node->uaddr & mask) !=3D (prev_n= ode->uaddr & mask)) { > + if (prev_node =3D=3D NULL || (node->uaddr & mask)= !=3D > + ((prev_node->uaddr + prev_node->s= ize - 1) & mask)) { > next_node =3D RTE_TAILQ_NEXT(node, next); > /* Don't disable coredump if the next nod= e is in the same page */ > if (next_node =3D=3D NULL || ((node->uadd= r + node->size - 1) & mask) !=3D > @@ -283,8 +283,8 @@ vhost_user_iotlb_cache_remove(struct virtio_net *dev,= struct vhost_virtqueue *vq > mask =3D ~(alignment-1); > > /* Don't disable coredump if the previous node is= in the same page */ > - if (prev_node =3D=3D NULL || > - (node->uaddr & mask) !=3D (prev_n= ode->uaddr & mask)) { > + if (prev_node =3D=3D NULL || (node->uaddr & mask)= !=3D > + ((prev_node->uaddr + prev_node->s= ize - 1) & mask)) { > next_node =3D RTE_TAILQ_NEXT(node, next); > /* Don't disable coredump if the next nod= e is in the same page */ > if (next_node =3D=3D NULL || ((node->uadd= r + node->size - 1) & mask) !=3D > -- > 2.39.2 >