Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2193520rdh; Tue, 26 Sep 2023 16:01:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGpGjPPjm8RrN0HpSlyldHxAXeaeUC/YRou101vKYAbwltJEh5cGZelQzNlFRjExOAc97h/ X-Received: by 2002:a05:620a:450f:b0:773:d86f:ec88 with SMTP id t15-20020a05620a450f00b00773d86fec88mr238551qkp.35.1695769268914; Tue, 26 Sep 2023 16:01:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695769268; cv=none; d=google.com; s=arc-20160816; b=Ls98rMKlx/1/pKR+fa94xxDYodUlMV/9R7duYrWb8Bo2SzwsglKuMlyle1oq/zaW52 SVfXukOaArDABceP0PyidR6BVM2FG4UDuF7mxCeS13k5biSM+Hlc/GaL09qUFsGNtA4W KS6h7rPRAUzsb6UiYR60axxR4FhL/ChZMbDh80ueBnYDnKbQ1StlDvhuuiF+U5j0T976 oheYgaLL+8HH7YgIcI8DqspqPyR8omTOoraULZPCnM0OZ5dw7A9YAH5PVgCsDZQ1ELAN DgL9dkhPdQ5NYDX8qQyPvIS1v9s/YRJysx7QFE9Z1Cy+z0qSUBbhw1sMUP8iN3aou9fx Z9wQ== 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=lJajdCncSMr7ZiqVnyceQ22WaLa+UzWhCY/lPANEMZs=; fh=dJp8FZn3+jiYGV+e7Ew7vHmAFoOpfPx8FCDDh6gjrPI=; b=omp2FShoW4taHRagYVBUzjxrMvO8JX4zU0mbjIi/wip2WM244DVlejQBBLxtxnCBuZ Gal7f2azuwYuiScAPvk5EmOM5KYkp/wlDfU5xAbjQDZufwNRJyKmB/VMdvO67D8rLA8I cQ4RF0tG3d4dFV5OPsHGQV7v4MRDapAcxbd8lkNE0nElWPYHTZlffS7TBPZ9Zr1qVd+8 VTiLZ7SnM6PMvb/VR/XNllHnD669qR6YvybSrH5TqVD91pEmps8zDLAFmqHKWOKwNAE4 jS1L7oyWods83e5dTl5CBofk1WYnOLM932XTt52Yjhc3XyqeEcgaCY2PUS6zG9WdSb9o 1JLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Uts2QJIU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id by6-20020a056a00400600b0068fc2f7cef3si13127822pfb.358.2023.09.26.16.01.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 16:01:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Uts2QJIU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 67D56818FBD9; Mon, 25 Sep 2023 20:34:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231433AbjIZDeM (ORCPT + 99 others); Mon, 25 Sep 2023 23:34:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229472AbjIZDeJ (ORCPT ); Mon, 25 Sep 2023 23:34:09 -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 425B6C9 for ; Mon, 25 Sep 2023 20:33:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695699200; 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=lJajdCncSMr7ZiqVnyceQ22WaLa+UzWhCY/lPANEMZs=; b=Uts2QJIUEu7opgPoemUJeHq6bmkEVxldeT+/2p9EKDoKwgpYDcAtJBzXQsqxdR0obOKVg8 o+lq2VBIfXhtmKXvcZqXQ4HY3JbwR8K8uBc1dZwMldbsLXUSfGAqVz0nl9c6z4vcAkqUEh S/i+P4w3DB545zOUMTgGIhFDgHlMLfs= Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-176-1ANg1V-HOZSArsdLendE5A-1; Mon, 25 Sep 2023 23:33:18 -0400 X-MC-Unique: 1ANg1V-HOZSArsdLendE5A-1 Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-5043c0cbb62so8937616e87.1 for ; Mon, 25 Sep 2023 20:33:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695699197; x=1696303997; 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=lJajdCncSMr7ZiqVnyceQ22WaLa+UzWhCY/lPANEMZs=; b=TUUWRMK1zHvP8nQTJfznL1mLC3PofXD80mL3H/WuQW0Loomt/M09v0sQv6fC9Ris28 POMumHfwB+2fD4UL/Urx/pM6F0kBL712NBlEM1enYLzlZtFxrRVXsCsevIesHFftgZMm 6bMN3IiIR6XaS/JRqCLt78Tur6MYtIOTiSaBjlBEtAnRnLXHe8UdY1/ukA6sXSjc2V/M zaWrDKjvAwh4ZYuewKzjB6WLx6QNduIge60nRm5+BVu7eWnzHVncWPMvSt5l3PO2Nx8w OPuPIf0qFnUUqEw/6aplSjjHvA/V07jvqJ6dj9ECT2r8xM9KMdFtRBR2idbnCdQJRhK7 +iZg== X-Gm-Message-State: AOJu0Yy2pRZz+sILWiWU6KVBxgCZNR4KlXVygqkkVTceyMTyhQ3Q89nX geQCS8ZHmyNfi35IaOD7tdgHumxaY9IUAuMcoLqWiCGBbMcACBSWaamj+kN2vjzpcKkHJQqSLNz X0MSCQ8eflde2l/6xe3ZGzAZ7d2V3SJ3TzFlWxa3u X-Received: by 2002:a05:6512:3582:b0:4fb:7675:1c16 with SMTP id m2-20020a056512358200b004fb76751c16mr6143404lfr.49.1695699197428; Mon, 25 Sep 2023 20:33:17 -0700 (PDT) X-Received: by 2002:a05:6512:3582:b0:4fb:7675:1c16 with SMTP id m2-20020a056512358200b004fb76751c16mr6143395lfr.49.1695699197146; Mon, 25 Sep 2023 20:33:17 -0700 (PDT) MIME-Version: 1.0 References: <20230912130132.561193-1-dtatulea@nvidia.com> <20230912130132.561193-7-dtatulea@nvidia.com> In-Reply-To: <20230912130132.561193-7-dtatulea@nvidia.com> From: Jason Wang Date: Tue, 26 Sep 2023 11:33:06 +0800 Message-ID: Subject: Re: [PATCH 06/16] vdpa/mlx5: Take cvq iotlb lock during refresh To: Dragos Tatulea Cc: =?UTF-8?Q?Eugenio_P=C3=A9rez?= , Si-Wei Liu , "Michael S . Tsirkin" , Saeed Mahameed , virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Parav Pandit , Xuan Zhuo , kvm@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 25 Sep 2023 20:34:12 -0700 (PDT) On Tue, Sep 12, 2023 at 9:02=E2=80=AFPM Dragos Tatulea wrote: > > The reslock is taken while refresh is called but iommu_lock is more > specific to this resource. So take the iommu_lock during cvq iotlb > refresh. > > Based on Eugenio's patch [0]. > > [0] https://lore.kernel.org/lkml/20230112142218.725622-4-eperezma@redhat.= com/ > > Suggested-by: Eugenio P=C3=A9rez > Signed-off-by: Dragos Tatulea Acked-by: Jason Wang Thanks > --- > drivers/vdpa/mlx5/core/mr.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/drivers/vdpa/mlx5/core/mr.c b/drivers/vdpa/mlx5/core/mr.c > index fcb6ae32e9ed..587300e7c18e 100644 > --- a/drivers/vdpa/mlx5/core/mr.c > +++ b/drivers/vdpa/mlx5/core/mr.c > @@ -590,11 +590,19 @@ int mlx5_vdpa_update_cvq_iotlb(struct mlx5_vdpa_dev= *mvdev, > struct vhost_iotlb *iotlb, > unsigned int asid) > { > + int err; > + > if (mvdev->group2asid[MLX5_VDPA_CVQ_GROUP] !=3D asid) > return 0; > > + spin_lock(&mvdev->cvq.iommu_lock); > + > prune_iotlb(mvdev); > - return dup_iotlb(mvdev, iotlb); > + err =3D dup_iotlb(mvdev, iotlb); > + > + spin_unlock(&mvdev->cvq.iommu_lock); > + > + return err; > } > > int mlx5_vdpa_create_dma_mr(struct mlx5_vdpa_dev *mvdev) > -- > 2.41.0 >