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 EC3E0455CC; Wed, 10 Jul 2024 05:23:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C411740A75; Wed, 10 Jul 2024 05:23:37 +0200 (CEST) Received: from lf-2-39.ptr.blmpb.com (lf-2-39.ptr.blmpb.com [101.36.218.39]) by mails.dpdk.org (Postfix) with ESMTP id C85D8402AF for ; Wed, 10 Jul 2024 05:23:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=s1; d=dayudpu-com.20200927.dkim.feishu.cn; t=1720581810; h=from:subject:mime-version:from:date:message-id:subject:to:cc: reply-to:content-type:mime-version:in-reply-to:message-id; bh=mEm0qIfWxCf2kjW/RpUOnPtHQxpQEEykgIieeCjvmN0=; b=Phta/FMuP3XUmAkzQ/xvi9Wf9Tg9Ttmv21WJCZR5iPPkCfPZHkwI0eAa2fc4ifWUIl6dtZ 2w0rAelpN4Fr/SZlDH6BtIfw48wpWIOngTtgWSh+ghO/mPJH86yxEp+3hEuTOeRicoMYbg WAZ8vnXY0CxFrvkQ+poS4iF8ucyo/HjaFTIIFvQXliLD/bzdyonE+sSZOr1xMM7UpEv6CN Z+uGkij7SGve4x3vuRnDDSgz+sJQZ5NQhIxCBY1f0cG3ISm43YUo5qRkEaMo0Qhil98pNw XnZ6XWHM0d2tf/CZrFz/OBCWNzn/C5GYTc3oOmAfVEHFpdmCW2QTc1ox5eq0rA== Content-Transfer-Encoding: 7bit Cc: , , , , , "BillXiang" Message-Id: <20240710032258.68712-1-xiangwencheng@dayudpu.com> References: <20240708065749.1131-1-xiangwencheng@dayudpu.com> X-Mailer: git-send-email 2.30.0 X-Lms-Return-Path: X-Original-From: xiangwencheng@dayudpu.com To: From: "BillXiang" Subject: Re: [PATCH] vhost: fix offset while mmaping log base address Mime-Version: 1.0 In-Reply-To: <20240708065749.1131-1-xiangwencheng@dayudpu.com> Content-Type: text/plain; charset=UTF-8 Date: Wed, 10 Jul 2024 11:22:58 +0800 Received: from localhost.localdomain ([124.64.23.34]) by smtp.feishu.cn with ESMTPS; Wed, 10 Jul 2024 11:23:28 +0800 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 From: BillXiang > From: "Chenbo Xia" > Date: Tue, Jul 9, 2024, 20:42 > Subject: Re: [PATCH] vhost: fix offset while mmaping log base address > To: "BillXiang" > Cc: "Maxime Coquelin", "Jianfeng Tan", "Tomasz Kulasek", "Pawel Wodkowski", "dev@dpdk.org" > > On Jul 8, 2024, at 14:57, BillXiang wrote: > > > > External email: Use caution opening links or attachments > > > > > > From: BillXiang > > > > For sanity the offset should be the last parameter of mmap. > > > > Fixes: fbc4d24 ("vhost: fix offset while mmaping log base address") > > The commit id length should be 12. > Thanks, I will mind it. > Since QEMU always send offset 0, I think it's no need to backport the > patch, so no cc-stable is fine. > I just think the code is confusing and I'm wondering whether the offset sent by QEMU or maybe other VM can be non-zero. If it's a mistake just fix it. > With above fixed: > > Reviewed-by: Chenbo Xia > > > Signed-off-by: BillXiang > > --- > > lib/vhost/vhost_user.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c > > index 5f470da38a..0893ae80bb 100644 > > --- a/lib/vhost/vhost_user.c > > +++ b/lib/vhost/vhost_user.c > > @@ -2399,7 +2399,7 @@ vhost_user_set_log_base(struct virtio_net **pdev, > > * mmap from 0 to workaround a hugepage mmap bug: mmap will > > * fail when offset is not page size aligned. > > */ > > - addr = mmap(0, size + off, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); > > + addr = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, off); > > alignment = get_blk_size(fd); > > close(fd); > > if (addr == MAP_FAILED) { > > -- > > 2.30.0