Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5037854rwl; Mon, 10 Apr 2023 22:43:21 -0700 (PDT) X-Google-Smtp-Source: AKy350ahMx3oC8JLwHcrEC5Z1tFUXr2TkbVPZZwyLzOacOukA6gLwW4Z00CQ6F/e7688XefERoO+ X-Received: by 2002:a05:6402:204c:b0:504:a291:3e50 with SMTP id bc12-20020a056402204c00b00504a2913e50mr1310931edb.8.1681191801384; Mon, 10 Apr 2023 22:43:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681191801; cv=none; d=google.com; s=arc-20160816; b=PSYcIIh/fmf0iwXKc8JOW9nonBoVHqwbgei2pvb0PHLaVnYCkoAw7bVctHoVkIDvPO OQyu78Xn6Px1f5N60/7wSHMwYsgQyZ/zOUzdrb6OUbhCrm9vOPad51j0ZFn6dpU7hO14 NyZO09cMw590hQk3DzHMIKQT1MOiiuNj0OYbGhiW+aXpWaJLnq8s38sQlWJSUEfQmdpL 8fpUtW/esl/aRsxajzOQ0RL/1VECHQdurVbqcgFcDx3nS91nav7Pv4ijAnXzqMGeh+PD G6aU+Uldo5HdbsC9Imo0stMqXriHJxelsN8MQK8i0Xjp792BPfQJPxk6ocLOdZqNZLqY fN3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=5Lc8+CXiaC7kZLTFmLHcV9MWZzh4/VM+o+UitxvfuTg=; b=DOyuYHz618/Imd7LRBM+tSm4rDkmz7MeVcPbPzXJkhWYvYVF1pmjqPnBj7i+dSSjCW nxDqF6xO+2KFj4ByTv1Q2SBKsHwugW31109jvdXxmkW3B6B+dwgk6eWCRIfXVhCkYeR3 ml0d/+fhOFyyYtpyA2avKDu2237NJ+dOpPYcR1RUfRxQyOtkXYsWCfwuenw3pwlm9AUz JQD719JWh/ytShnHV4VFpCDhcwTt5+a9vL67NrjUAzRaSAaznoUscMq7FfnjxOYiqxEx 4E4saPXu4QB/z04bwVr1h2l19a7okKGGTiwnKxSl0wyhdFg6+l0v+TxgoPU19vbjEO8+ hkuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="NS88oX/W"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d2-20020a50fb02000000b0050480d8a036si8203098edq.248.2023.04.10.22.42.53; Mon, 10 Apr 2023 22:43:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="NS88oX/W"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229896AbjDKFl4 (ORCPT + 99 others); Tue, 11 Apr 2023 01:41:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230088AbjDKFls (ORCPT ); Tue, 11 Apr 2023 01:41:48 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C7932D61 for ; Mon, 10 Apr 2023 22:40:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681191654; 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=5Lc8+CXiaC7kZLTFmLHcV9MWZzh4/VM+o+UitxvfuTg=; b=NS88oX/WmbVEsHcxnsbRI5Zzv/uOcooeCQPaDZ1D1mYh/FvebBRZcVymmnvk0YnvN5vrMg ESTqa1NWohpA1lIILVMN9LWRFbpPuwJsZJ/tq0qzrXC6RoWCiL0uUaJU7oP++ejfH3rOaQ KXQtPY4k+DioH6fwt16uI/msYuUIhSI= Received: from mail-oa1-f69.google.com (mail-oa1-f69.google.com [209.85.160.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-562-MYOy_g3LOi6xnZmB4xP6kQ-1; Tue, 11 Apr 2023 01:40:53 -0400 X-MC-Unique: MYOy_g3LOi6xnZmB4xP6kQ-1 Received: by mail-oa1-f69.google.com with SMTP id 586e51a60fabf-1840884e926so5927437fac.15 for ; Mon, 10 Apr 2023 22:40:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681191652; x=1683783652; 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=5Lc8+CXiaC7kZLTFmLHcV9MWZzh4/VM+o+UitxvfuTg=; b=rec4FthiFPIeBy+SleOU7Ya0LRG9+jE1q7H+pCUHh5c2NK9zyQTdeZksj410tY5Wbb OZ7KMM7h/IBjl/70IoPmCP8VSjvHqTB8tNga+eI9AKfX9PrIfIuGiqc+9xrfaqRYIEBQ aSHrtPHVRF0eWi7Hm6atpmf6umD81nS9sDJ9q8qVLkoLEJqbXSuDD6H8TdnpRINE3lwS QgN/3EgfcO3vKSIw2nDv0Sqj30+ormXMQqXqJjh1suuKKpUS7ktdugbnZj65P9mv/4AB dQM8VUlzny+pXtuB8MhuJ9m1S2mVM4L5C15XS3it4DwUBfrkhZUztzl/F5lTr52Wlajb O0AA== X-Gm-Message-State: AAQBX9dRssPsOdn1gN+83AvEd/PER/YqfZImoN5tUTkB8xPpqmUmFgqy tDVLGgIom2c7Tod3YmNeg/qrU1kI8JZiYmpkPPGOv3fIdwcH5wnLMbBEZfOjwr35lfcUj1JmAaT qMo3dY50qLL5d52jxsw1HIXyU7bI6qbRf2BzgS8IW X-Received: by 2002:aca:2105:0:b0:37f:ab56:ff42 with SMTP id 5-20020aca2105000000b0037fab56ff42mr382975oiz.9.1681191652468; Mon, 10 Apr 2023 22:40:52 -0700 (PDT) X-Received: by 2002:aca:2105:0:b0:37f:ab56:ff42 with SMTP id 5-20020aca2105000000b0037fab56ff42mr382966oiz.9.1681191652266; Mon, 10 Apr 2023 22:40:52 -0700 (PDT) MIME-Version: 1.0 References: <20230404131326.44403-1-sgarzare@redhat.com> <20230404131326.44403-5-sgarzare@redhat.com> In-Reply-To: <20230404131326.44403-5-sgarzare@redhat.com> From: Jason Wang Date: Tue, 11 Apr 2023 13:40:41 +0800 Message-ID: Subject: Re: [PATCH v5 4/9] vringh: define the stride used for translation To: Stefano Garzarella Cc: virtualization@lists.linux-foundation.org, eperezma@redhat.com, stefanha@redhat.com, Andrey Zhadchenko , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, "Michael S. Tsirkin" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 4, 2023 at 9:14=E2=80=AFPM Stefano Garzarella wrote: > > Define a macro to be reused in the different parts of the code. > > Useful for the next patches where we add more arrays to manage also > translations with user VA. > > Suggested-by: Eugenio Perez Martin > Signed-off-by: Stefano Garzarella Acked-by: Jason Wang Thanks > --- > > Notes: > v4: > - added this patch with the changes extracted from the next patch [Eu= genio] > - used _STRIDE instead of _SIZE [Eugenio] > > drivers/vhost/vringh.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c > index 0ba3ef809e48..4aee230f7622 100644 > --- a/drivers/vhost/vringh.c > +++ b/drivers/vhost/vringh.c > @@ -1141,13 +1141,15 @@ static int iotlb_translate(const struct vringh *v= rh, > return ret; > } > > +#define IOTLB_IOV_STRIDE 16 > + > static inline int copy_from_iotlb(const struct vringh *vrh, void *dst, > void *src, size_t len) > { > u64 total_translated =3D 0; > > while (total_translated < len) { > - struct bio_vec iov[16]; > + struct bio_vec iov[IOTLB_IOV_STRIDE]; > struct iov_iter iter; > u64 translated; > int ret; > @@ -1180,7 +1182,7 @@ static inline int copy_to_iotlb(const struct vringh= *vrh, void *dst, > u64 total_translated =3D 0; > > while (total_translated < len) { > - struct bio_vec iov[16]; > + struct bio_vec iov[IOTLB_IOV_STRIDE]; > struct iov_iter iter; > u64 translated; > int ret; > -- > 2.39.2 >