Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3115792pxf; Mon, 15 Mar 2021 01:33:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8891Jxp8KIyjGomcPVb9aPM7O+x0ZFoGHAK7kQl5gHRBYre/WQJ92ENwQntnz1H0hod4R X-Received: by 2002:a17:907:72ce:: with SMTP id du14mr22253677ejc.301.1615797231598; Mon, 15 Mar 2021 01:33:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615797231; cv=none; d=google.com; s=arc-20160816; b=KceJMGymxngz5ZbJ7mNyZ1SZHNjQau8tdWVN81J1HmbrhUZ4JUVAQj/FvaaC2J4RWN DuExvDdA+ohflIduM4oFdbsUiXewscWOoQBgrXe4l0ZTr1sxZGqfH0gLLqT4e5ZbMu1g JeNt9FYe8WYSv6J5Oe+jkitbcof4UQeAC2lYy4Okrkfxw+NB+o+MNiig0mVfn1pK7rri fmYnlwGPO1G8aVqvEMii2AUDVGUjBiFQakXlr0ozbjtGK2d1CJVwfVli5oAG4LzNIpez 2xpnLyO/nn/ZiJZZMuVTbl+qkGb2w0tG2QWNmb/TmN9oJ7pnUbYAso1W9qQv2m8PigiO GxQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject:dkim-signature; bh=ZKg5OJ0Wle9GUUJPspxr/sYEl3Le9qh1nxrGMT+1Rf8=; b=eZOnoxMiZS70JZS3lAi0aMeKbDCvlKT1xCO25sc1J1OAHXX0WN+tvJqlnJH0KR+916 s/krvzzWQsH9fzb1GUd38+DRgFmpnDgjDMeftGPaig+7wrF9fm1Xhd8j4x6VpPMK1+mD cDLxH8yB7yTq0IknMGZJrS6+gPLaiemRom/FoUaWSjb7PuWymnWu0joqiRP23aJfHSqk wg2sS1b94IHzVBcYrXkHmnUbPXqY6PWiBW9+woypE/n5nzJgeGPwAgAWyM0fG0mxy8eu bo8Jw3GU54fDFQECVMin7PV8yA1ae1ILBfiDvPxJp2f/VWbNioGKIQgNq+fm+YrhBdd/ DpDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=APt0FYtD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d3si10868599eds.83.2021.03.15.01.33.29; Mon, 15 Mar 2021 01:33:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=APt0FYtD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S229675AbhCOIb5 (ORCPT + 99 others); Mon, 15 Mar 2021 04:31:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:22729 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229570AbhCOIbZ (ORCPT ); Mon, 15 Mar 2021 04:31:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615797084; 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=ZKg5OJ0Wle9GUUJPspxr/sYEl3Le9qh1nxrGMT+1Rf8=; b=APt0FYtDH2Y2SXzyABS/0QaP2VfRoF94ExPy/fwFO1GNklsxcpKFtrgbUlBfFzbOVEARrZ i9r4k3TDBg6k3zwYUnJUoXwsLNeWHwDVVOd0BNHUXqzhbQ/Di+8+51OWF90B0JcI4DpGfc aCQSxGJXztJQtWNho2Lk3GqbsQpNefo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-343-aFVIdB69NjiChjbvg0Tg4g-1; Mon, 15 Mar 2021 04:31:20 -0400 X-MC-Unique: aFVIdB69NjiChjbvg0Tg4g-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 79845100C665; Mon, 15 Mar 2021 08:31:19 +0000 (UTC) Received: from wangxiaodeMacBook-Air.local (ovpn-12-245.pek2.redhat.com [10.72.12.245]) by smtp.corp.redhat.com (Postfix) with ESMTP id 77A355D745; Mon, 15 Mar 2021 08:31:13 +0000 (UTC) Subject: Re: [PATCH] vhost: Fix vhost_vq_reset() To: Laurent Vivier , linux-kernel@vger.kernel.org Cc: virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, "Michael S. Tsirkin" , kvm@vger.kernel.org References: <20210312140913.788592-1-lvivier@redhat.com> From: Jason Wang Message-ID: <7bb4ee1a-d204-eb94-792f-ca250dacacea@redhat.com> Date: Mon, 15 Mar 2021 16:31:11 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210312140913.788592-1-lvivier@redhat.com> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ?? 2021/3/12 ????10:09, Laurent Vivier ะด??: > vhost_reset_is_le() is vhost_init_is_le(), and in the case of > cross-endian legacy, vhost_init_is_le() depends on vq->user_be. > > vq->user_be is set by vhost_disable_cross_endian(). > > But in vhost_vq_reset(), we have: > > vhost_reset_is_le(vq); > vhost_disable_cross_endian(vq); > > And so user_be is used before being set. > > To fix that, reverse the lines order as there is no other dependency > between them. > > Signed-off-by: Laurent Vivier Acked-by: Jason Wang > --- > drivers/vhost/vhost.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c > index a262e12c6dc2..5ccb0705beae 100644 > --- a/drivers/vhost/vhost.c > +++ b/drivers/vhost/vhost.c > @@ -332,8 +332,8 @@ static void vhost_vq_reset(struct vhost_dev *dev, > vq->error_ctx = NULL; > vq->kick = NULL; > vq->log_ctx = NULL; > - vhost_reset_is_le(vq); > vhost_disable_cross_endian(vq); > + vhost_reset_is_le(vq); > vq->busyloop_timeout = 0; > vq->umem = NULL; > vq->iotlb = NULL;