Received: by 2002:a05:7412:d008:b0:f9:6acb:47ec with SMTP id bd8csp330009rdb; Tue, 19 Dec 2023 19:49:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IEx903oa5zpMXEer+DmZ+865ZFmd+7h/blMAyVKmqpkv1xqlaPfB+g6Ed5riNq1Df1+dOFs X-Received: by 2002:a9d:6b99:0:b0:6d9:da4b:4dcb with SMTP id b25-20020a9d6b99000000b006d9da4b4dcbmr20088684otq.76.1703044179405; Tue, 19 Dec 2023 19:49:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703044179; cv=none; d=google.com; s=arc-20160816; b=usfgtxZgz9etQoqmMU4p5tyvTLLthio8WVcFVe5v78C/PN2+0+tj3OYVPV5aNNVJl4 MvsuhYZPJnYZ7WnAFT8lLf8k0MZJn/PaRxAF+dP73Hn3qyeCPSLDUDPxW9i5JqPVvlzt YGF2epYzs/0IobHu/cq6O/lliEat9b6vI5MWAawAjJu+e0aRZTs8asGcvQYxSyRyzc/J K23X0ZnSZTy6eig5cgjy/fUYMotU6HYLs1MssRPqhmGhfZfh//lU4bOvQbWDuAyVb9U9 LIhmiQ446TOhTUia0z4lk6FPqoa1gF7k+Hkd6UkWZi8TgUeu68x+H5lvXQaTcY0PU/rO uzBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=zeRKaaUGMF/rV1Pw2tqp6lNgEKTL5KPcCr8EDMoKMeM=; fh=uBBQxvr6uZhu0dMrEZcRojexdDFCB7vJ0ax5P/j8SQ4=; b=TBdwzASkgK49uiiUTum4lp9BIPEQOdcQd4buPrEmOedRUtdczNn3wTxOXcD071pWZ1 ytwY68kM21pg9A9hhVnrQnMBFm4P7aomN7jIHGBYeZcv06n032pTy3lgaeB1n2ZSY6aG HUH/F5hVUFFOula/NARvuGoPP3t4JNdJfHAJ33BAyRWkj3PsdhllVfkmhdtnWPSbqp2a 63pcTVWpgiWiDLVXtVenX96HhA/t7JBbaab/S769IBS1p24q0oKzdVo288p5oguzAZu5 0n7pzzG+GGjh0nSqDXBI9paVYDKBnc0qFOU77Nv0NZ9bg7L675f9HVjUAImLRWUldCy5 RsAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BoVBXp1a; spf=pass (google.com: domain of linux-kernel+bounces-6332-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6332-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id k1-20020a63d841000000b00584ca25959csi20664342pgj.540.2023.12.19.19.49.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 19:49:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6332-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BoVBXp1a; spf=pass (google.com: domain of linux-kernel+bounces-6332-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6332-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 976C5288723 for ; Wed, 20 Dec 2023 03:49:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D0A42208A6; Wed, 20 Dec 2023 03:47:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="BoVBXp1a" X-Original-To: linux-kernel@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B41C41F60A for ; Wed, 20 Dec 2023 03:47:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703044042; 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=zeRKaaUGMF/rV1Pw2tqp6lNgEKTL5KPcCr8EDMoKMeM=; b=BoVBXp1aSRuYG6C7ze3k3Yd3ctOJK2iBDudvgG7XHsgESZ+SRzWqki6ANfZuOSGlfdmjLQ MYSmgshA0XmnkBM7WA821on6m8z9qpLuUZXSZWilWv/jALwuctlZY5iUfp+PgmCfs8lIm1 FWpZ5eviBUjrsI0bOU0IaVcUoKLPZWI= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-362-LuOJU51RPbyuhVfnRcm59g-1; Tue, 19 Dec 2023 22:47:20 -0500 X-MC-Unique: LuOJU51RPbyuhVfnRcm59g-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-77fb91da85cso761788585a.2 for ; Tue, 19 Dec 2023 19:47:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703044040; x=1703648840; 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=zeRKaaUGMF/rV1Pw2tqp6lNgEKTL5KPcCr8EDMoKMeM=; b=XPC3+CgXCy9Ho8zF81/Yny/SG7p4pGewx9EFBryAJufx7C1HHC2gXPGARVnHGGgIZe Vy3jouBTk7EmEHJbtZ7SxUu525hDcQo83HcLg9lH7Moc4998PwVW9xZWwLqphThhAEuV 8f+WfcUnJoeM9R8H1dxSbjulT3yDrGieE90nY6BE5aK2o1zje1Tbx+YfECdEj3f1XH8X SdpvQ4vfMBaf60SHKyV2+bXsjrW863P1Vl7VDcu38cundiLoqCy2/5abJpU7LRTKvnmY K8h6N46ZEHNzov9jEc0s8ZEJiT+SZiJ3UOt4E7wClfKuSBOaCpTfE0b3753ng6NOYyMQ gg6Q== X-Gm-Message-State: AOJu0YzsDa7LTa5zE2PGehB8PcRLGZ+UxvufxcCKxveUbY9jkMQCW9Mh XORZb7wDqlQ8zqz5TWjFPHgM/DvQB2Kz0uyNVZ7vLACOcj5RB5AUDZLUZ55WzB3EX1KLbCBbyEz TR8UDEpJrAksDXFuQSnfoS1DZ12dt2qHx6QAaYgxp X-Received: by 2002:a05:620a:1025:b0:781:2e4:a333 with SMTP id a5-20020a05620a102500b0078102e4a333mr1851792qkk.101.1703044040362; Tue, 19 Dec 2023 19:47:20 -0800 (PST) X-Received: by 2002:a05:620a:1025:b0:781:2e4:a333 with SMTP id a5-20020a05620a102500b0078102e4a333mr1851780qkk.101.1703044040147; Tue, 19 Dec 2023 19:47:20 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231219180858.120898-1-dtatulea@nvidia.com> <20231219180858.120898-15-dtatulea@nvidia.com> In-Reply-To: <20231219180858.120898-15-dtatulea@nvidia.com> From: Jason Wang Date: Wed, 20 Dec 2023 11:47:08 +0800 Message-ID: Subject: Re: [PATCH vhost v4 14/15] vdpa/mlx5: Introduce reference counting to mrs To: Dragos Tatulea Cc: "Michael S . Tsirkin" , Eugenio Perez Martin , Si-Wei Liu , Saeed Mahameed , Leon Romanovsky , virtualization@lists.linux-foundation.org, Gal Pressman , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Parav Pandit , Xuan Zhuo Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Dec 20, 2023 at 2:10=E2=80=AFAM Dragos Tatulea wrote: > > Deleting the old mr during mr update (.set_map) and then modifying the > vqs with the new mr is not a good flow for firmware. The firmware > expects that mkeys are deleted after there are no more vqs referencing > them. > > Introduce reference counting for mrs to fix this. It is the only way to > make sure that mkeys are not in use by vqs. > > An mr reference is taken when the mr is associated to the mr asid table > and when the mr is linked to the vq on create/modify. The reference is > released when the mkey is unlinked from the vq (trough modify/destroy) > and from the mr asid table. > > To make things consistent, get rid of mlx5_vdpa_destroy_mr and use > get/put semantics everywhere. > > Reviewed-by: Gal Pressman > Acked-by: Eugenio P=C3=A9rez > Signed-off-by: Dragos Tatulea > --- Acked-by: Jason Wang Thanks