Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3273413imm; Mon, 6 Aug 2018 01:35:28 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe8Jwhjb3KrfMbYuOcQAzUiY4t+XSi3DuOy5NmggSiVXoCoi8NGCB2jv1q4XMovB0ORS20i X-Received: by 2002:a17:902:900a:: with SMTP id a10-v6mr10317840plp.143.1533544528123; Mon, 06 Aug 2018 01:35:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533544528; cv=none; d=google.com; s=arc-20160816; b=jAKpXOR3oPDXWhjrYo00g04S0m51+LKX9f0PyC3lvGks7NkMPyVb5z3y9y5nrVD9/E akfou2MNr/C9BsE94woOiQz0kAjkaMKDIjKybf3S+fPf0CxMb4CnZGCT306+6gk0Ctth kiKyujEjOSDG4kSlzurwyDmdP1AWijGxNPqbK7kRoCwxFRZynbg0QyU9I8CiSRp7jjBb iVtej8TndiHHXeTjS264IC2Msq0Ic2BubX1CGJKN4/QvnbOBfz869A5x2kWyKkAHmrnU GUYe6wDKuVUg9VhJvzeRaNiDagXoMuJpX4Q37PlxmZHo2mazS5dxAky5njX18nHpYexm FnHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:arc-authentication-results; bh=hgHhyb1hqwXzoRx7xNQEOb93vMheGIyoIL73VIOh7Gg=; b=agvo1OSPdBzs6sBaC8RI8r014SYictcuolMiJuhWFnGM5GkmOHGDF+dUqz4Z3ovY2v Rbr/O3967qjDIW5uIDQ9maX6qMAEvq9znE6kNstqWcjk/uxSDzZPMStctEhsfkSz/A9E MNWmFzFZOKUg8BIUVWWPznY3BJB0FSXoU5XEFg/syrhZYn+HD+Zzz5eIp04EnOSxY4Ie XJQQIKEp5rVXeYSPLEJ52YQrCnnKN2kiTHLiAqKrzCg0UWLbbiOFZgtIuHBhxYnfZF0p lGQ8lSRzELrCXXqK9Us6l3ATHjlWE1ZjU+4XHugjxmtVJOe3l6XmnUNS6F084tq/f49D HuVQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n9-v6si11935563pff.370.2018.08.06.01.35.13; Mon, 06 Aug 2018 01:35:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727032AbeHFKlr (ORCPT + 99 others); Mon, 6 Aug 2018 06:41:47 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:10670 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725951AbeHFKlr (ORCPT ); Mon, 6 Aug 2018 06:41:47 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id C0630ECF301E1; Mon, 6 Aug 2018 16:33:44 +0800 (CST) Received: from [10.177.253.249] (10.177.253.249) by smtp.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.399.0; Mon, 6 Aug 2018 16:33:39 +0800 Subject: Re: [V9fs-developer] [PATCH] net/9p: avoid request size exceed to the virtqueue number in the zero copy To: jiangyiwen , Eric Van Hensbergen , Ron Minnich , Latchesar Ionkov , Dominique Martinet References: <5B63FB4D.1050703@huawei.com> CC: , Linux Kernel Mailing List , From: piaojun Message-ID: <5B6807BB.9010803@huawei.com> Date: Mon, 6 Aug 2018 16:32:59 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <5B63FB4D.1050703@huawei.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.253.249] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Yiwen, On 2018/8/3 14:50, jiangyiwen wrote: > Unfortunately, when the address(input and response headers) are not > at page boundary, it will need two extra entry in the zero copy, or > else it will cause sg array out of bounds. > > To avoid the problem, we should subtract two pages for maxsize. > > Signed-off-by: Yiwen Jiang > --- > net/9p/trans_virtio.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c > index 6265d1d..63591b2 100644 > --- a/net/9p/trans_virtio.c > +++ b/net/9p/trans_virtio.c > @@ -754,11 +754,12 @@ static void p9_virtio_remove(struct virtio_device *vdev) > .cancel = p9_virtio_cancel, > /* > * We leave one entry for input and one entry for response > - * headers. We also skip one more entry to accomodate, address > - * that are not at page boundary, that can result in an extra > - * page in zero copy. > + * headers. We also skip three more entrys to accomodate > + * (input + response headers + data pages), address > + * that are not at page boundary, that can result in > + * an extra page in zero copy. Here should be two extra pages. Thanks, Jun > */ > - .maxsize = PAGE_SIZE * (VIRTQUEUE_NUM - 3), > + .maxsize = PAGE_SIZE * (VIRTQUEUE_NUM - 5), > .def = 1, > .owner = THIS_MODULE, > }; >