Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp172549imm; Fri, 3 Aug 2018 01:19:55 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfbACvszbz9h4TkEtXuAp+ABWsTgmadCfF2sBS43q/hiib3MBJYLbHLW6BdnXubQKk+r68A X-Received: by 2002:a62:34c4:: with SMTP id b187-v6mr3254271pfa.15.1533284395628; Fri, 03 Aug 2018 01:19:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533284395; cv=none; d=google.com; s=arc-20160816; b=o21Rf3vRQv85i6/kGWYpv6bUlSPYbDcIxcsDzMPdnQpQRjRLUfMHfVEgSB8XKJaBYZ kpfpUZu1Fuq+HYTiT+2h1NxJoln/9LwIhSkZ1bJK5/PkqACgZrPWlVAenclH0W00nBy4 HRwjlLyoztfD4hQWbKUEOVpNl8O+vi1F3XDSdRy01VqaMpPF4msnycd++vXbgU3HTcOh 3DscZJXALXKZKjZvSXtGxsfnE7q/hjJBb/blenEiEUGOvbxiSpRIlle/6r7GsDt3KiGm FaVvHDSplhgSNh7NziCqnSwH6WWl7KOgViWmrvsdffDNaOHETmBduSllhAfRf2R+aThO uehg== 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=k+2ZgSQdbsS/qHTk8rQxUMBqezsI7DIIYNAzwpAA6uU=; b=SzQD1AUkhQM0jOPGpwbnQ0FZUl3OVsDdBtrZo5Tjnzvlmml8fD+8234XC6kBKE1QWf luuAMy1+Xu9XVKl86k/UovXMaEN4MfnbUIQAvcsc9o6OkXAyXLtJVU/K6vJdLN//J4D9 8kcEs4U5otlXM6cjsEQHXxX+RsBKqrazed7gjhX7yuPxsEQA3BSJ6qsO1ZEZmzsjV6Tw qG+2e8IlqhnpSKV0lNDrxf97hP0bMK7td+K1pafszTMlMs4Dxrgx8lmZiyxq+59h7u3X 836FbExpFaQKwsmLLY3u4VtcktEv9vyhzxLsVrq8wOQRYPdTFrII849i8zGWQ/HDfsof YDuQ== 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 l88-v6si4548413pfi.179.2018.08.03.01.19.41; Fri, 03 Aug 2018 01:19:55 -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 S1731211AbeHCKNn (ORCPT + 99 others); Fri, 3 Aug 2018 06:13:43 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:50292 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727682AbeHCKNn (ORCPT ); Fri, 3 Aug 2018 06:13:43 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 26388B1A0D732; Fri, 3 Aug 2018 16:18:26 +0800 (CST) Received: from [127.0.0.1] (10.177.16.168) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.399.0; Fri, 3 Aug 2018 16:18:22 +0800 Subject: Re: [V9fs-developer] [PATCH] net/9p: avoid request size exceed to the virtqueue number in the zero copy To: Dominique Martinet References: <5B63FB4D.1050703@huawei.com> <20180803073240.GA26848@nautica> CC: Eric Van Hensbergen , Ron Minnich , Latchesar Ionkov , Linux Kernel Mailing List , , From: jiangyiwen Message-ID: <5B640FCC.3000704@huawei.com> Date: Fri, 3 Aug 2018 16:18:20 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20180803073240.GA26848@nautica> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.16.168] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/8/3 15:32, Dominique Martinet wrote: > jiangyiwen wrote on Fri, Aug 03, 2018: >> 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. > > Good catch, that must have been painful to figure. > > Given we know how big the headers are (something like 11 or 23 bytes > depending on the op/direction, it's capped by P9_IOHDRSZ at 24), > couldn't we just cheat and not use the start of the buffer if we detect > it's overlapping? > Actually, generally the P9_IOHDRSZ will not cause the problem, because 24 bytes is too small, but P9_ZC_HDR_SZ(4096 bytes) often cause two pages. So I have a question about why we need to use P9_ZC_HDR_SZ, actually we may use P9_IOHDRSZ instead. > It's probably faster to memcpy a few bytes than to use two pages for the > sg list... > It's definitely ugly though, just taking more margin here is probably > just as good. > > > > I'm going to be picky about English again, sorry, please bear with me. > >> Subject: net/9p: avoid request size exceed to the virtqueue number in >> the zero copy > > This is >72 characters so a little bit too long, if possible to shorten > it. > I'm also not sure 'exceed' is a noun so I probably wouldn't have > understood this sentence without the rest of the message... > > The balance is difficult but it doesn't need to contain too much details > either something like "9p/virtio: reduce transport maxsize" is simple > but probably enough as it describes what is done: someone can look at > the rest of the message for the justification. > Thanks, I will resend the patch later. > > >> 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 > > "entry"'s plural is "entries", this word is in checkpatch's dictionary > as a common typo Thanks, I will modify it. > >> + * (input + response headers + data pages), address >> + * that are not at page boundary, that can result in >> + * an extra page in zero copy. >> */ >> - .maxsize = PAGE_SIZE * (VIRTQUEUE_NUM - 3), >> + .maxsize = PAGE_SIZE * (VIRTQUEUE_NUM - 5), >> .def = 1, >> .owner = THIS_MODULE, >> }; > > Thanks, >