Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp10270879pxu; Tue, 29 Dec 2020 20:30:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJxEV052PlQAu96HxrQAtwGbvg371lZ3ZeYWky3MNbnHUORoDo5iKaHp+GVZ0LgoMoa1KV0Q X-Received: by 2002:aa7:d6d8:: with SMTP id x24mr49884249edr.105.1609302619259; Tue, 29 Dec 2020 20:30:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609302619; cv=none; d=google.com; s=arc-20160816; b=AbLwgBcf148fSbpErkl56uvTvRrqaV7PeFKVkk/qwmCAPStS0AkaVRjQIlhaI/hMeU 1r9prgTZQeIw35tqmtlpUXDvsJ2lH+4FsG550J3Mdasj0+/d+ZfKdVba9KUVDSxc0G+J 2GN5oVze+Xf6TH9Gas0jR1eeWMCqDCPFe/wSAjvnqnvA8vRfbxzS46zJn7D9l3DyGj7h 5LXZejTWYtgXMEhnDi1T/JJJ/AUR+aIEUT/awwsTykj2UlDc2ozvcuKh8dNrETJZv0W4 kSdxmdznr9lDDMolqe7QRwOo+gj69BfkAk0Psppdghy984WvsIUBI2siX8Nme4rHJ+yP R8lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=F7VOtk7yYlfXfkKIWDbIt/rwZpMlvsngOus3otwzlNY=; b=0l0Ywl/SPJqq0kJjW/smy683xaVJZ7RUdw5rAPOti/cO8eJoN0zXHD6N8fMuqCy2de eGjXjCN9qFYZ7qoErLwqwsL56qDy2wq+K+aPx33x5ZG42qu8Jf8uo614FwTS144lVBBr ig5tpGcJ5QIVqZgOYaHOs1BtAxe3x8dqV0gXmvsIoIvIfVuH/hT6f7m+HSxgX+4TTEw5 H4epOIiMmu9aNNdn6mZXbyKcAMFPW0qIGkA6l6wugWJQ1/PR0Yz/s3ESdMd+zkh+Iwix w0jaQNuiQaEIfYF4oo87YkpcaurcNs5b4eczWl8oL5mROEVH+XlYyaV5NsqX6LUdtEsb PIKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bZKF02r4; 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 ar24si12554503ejc.359.2020.12.29.20.29.56; Tue, 29 Dec 2020 20:30:19 -0800 (PST) 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=bZKF02r4; 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 S1726302AbgL3E33 (ORCPT + 99 others); Tue, 29 Dec 2020 23:29:29 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:26496 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726161AbgL3E32 (ORCPT ); Tue, 29 Dec 2020 23:29:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609302482; 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=F7VOtk7yYlfXfkKIWDbIt/rwZpMlvsngOus3otwzlNY=; b=bZKF02r4WoA1bRj3Nn8vcn2Sjrge5NIqkkSZlpXAUZmyAazufSEBWvcW9uyD8bRtQuwCYF AVDrjPgLj9QM4lWnZbznXGaYJv0R8nmiDf2Wrl5CeWmWmBSNRw1Aslp4toDISvpKoPW0W0 ZMP64l8D8jgh2l1lMF9zqfG6ECNjmBo= 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-52-rqaq5UO7OvObBieWgbT8Bg-1; Tue, 29 Dec 2020 23:28:00 -0500 X-MC-Unique: rqaq5UO7OvObBieWgbT8Bg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DF011E75A; Wed, 30 Dec 2020 04:27:58 +0000 (UTC) Received: from [10.72.13.30] (ovpn-13-30.pek2.redhat.com [10.72.13.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 78F2271CBE; Wed, 30 Dec 2020 04:27:48 +0000 (UTC) Subject: Re: [PATCH 10/21] vhost: support ASID in IOTLB API To: Eli Cohen Cc: mst@redhat.com, eperezma@redhat.com, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, lulu@redhat.com, eli@mellanox.com, lingshan.zhu@intel.com, rob.miller@broadcom.com, stefanha@redhat.com, sgarzare@redhat.com References: <20201216064818.48239-1-jasowang@redhat.com> <20201216064818.48239-11-jasowang@redhat.com> <20201229102059.GB195479@mtl-vdi-166.wap.labs.mlnx> From: Jason Wang Message-ID: <0fc761c7-6053-c098-a251-ae2f7380f95e@redhat.com> Date: Wed, 30 Dec 2020 12:27:47 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201229102059.GB195479@mtl-vdi-166.wap.labs.mlnx> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/12/29 下午6:20, Eli Cohen wrote: >> -static int vhost_process_iotlb_msg(struct vhost_dev *dev, >> +static int vhost_process_iotlb_msg(struct vhost_dev *dev, u16 asid, >> struct vhost_iotlb_msg *msg) >> { >> int ret = 0; >> >> + if (asid != 0) >> + return -EINVAL; >> + >> mutex_lock(&dev->mutex); >> vhost_dev_lock_vqs(dev); >> switch (msg->type) { >> @@ -1135,6 +1138,7 @@ ssize_t vhost_chr_write_iter(struct vhost_dev *dev, >> struct vhost_iotlb_msg msg; >> size_t offset; >> int type, ret; >> + u16 asid = 0; > You assume asid occupies just 16 bits. So maybe you should reserve the > other 16 bits for future extension: > > struct vhost_msg_v2 { > __u32 type; > - __u32 reserved; > + __u16 asid; > + __u16 reserved; > union { > > Moreover, maybe this should be reflected in previous patches that use > the asid: > > -static int mlx5_vdpa_set_map(struct vdpa_device *vdev, struct vhost_iotlb *iotlb) > +static int mlx5_vdpa_set_map(struct vdpa_device *vdev, u16 asid, > + struct vhost_iotlb *iotlb) > > -static int vhost_vdpa_process_iotlb_msg(struct vhost_dev *dev, > +static int vhost_vdpa_process_iotlb_msg(struct vhost_dev *dev, u16 asid, > struct vhost_iotlb_msg *msg) > > etc. Good catch. This is a bug of the code actually. Since I want to stick to 32bit to be large enough for e.g PASID. Will fix. Thanks >