Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp700430rdg; Thu, 12 Oct 2023 20:07:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFZLr6yXlL1qvqKOYC7VVSwEdxu4//gDUbT5KBbfweynw351/TnwBVVntXatYXfjf+i/8iP X-Received: by 2002:a05:6a20:5485:b0:136:e26b:6401 with SMTP id i5-20020a056a20548500b00136e26b6401mr33682274pzk.16.1697166420499; Thu, 12 Oct 2023 20:07:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697166420; cv=none; d=google.com; s=arc-20160816; b=bMBSFYz0QBsLkU/JRJR8Z9zeeCgpg+4olDk2nYb1L+06jvPP9NVIimqM0uDblX8dPH yrODesDl2QGHol/dkA9s+LEZsCBemtfVqjavD7PYJVqmlSB7drgGpDKjBD96GtAQ3Gaz 97u+Nm8EQE5xLPd6c2yZrmk+89FZu+5/t8fZFIjfezC4hLYOCzMCZp4IxEFeXiMv43hp CPkLyJWGMYklzQkwS7IEBD1kBf6lPl/sAdFm1iInxiME9m2gUrmBoHP98YILA30QghDp AMwh4Emz/fniW3QnjMWzzBvUL5BBJiz2VnBDGF/1sEIif63+TxZRjLlWWw5kzAZAlzkD 0lXQ== 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=3zDrSwzdAeWMb/6P4lK++T4MCrJYZFn5wg8AsD0sQBw=; fh=mDp0NpY7pu5QEDNZnAujkyR0YB3lgZTBOIKjbR72oCc=; b=Vpgg7ECo1BDvT7xW2JAjiMqakR4hw4ygZLOizg8sZaqZk3caMwJHZsDtHopy3/ZFuj qEw0/INjYNJB7GBYmME1CmrCr7+oRkv/B4jYqabBuIUY7mvXLKrUXGSL+XrbcfLyOJqf zWicxPOQPuRqD3Ql5hBHFaX3+9BcC1kxtxcF/kAKu1w4CAvzk6jG+PsZ2QIPEG/gOosS bGoaEz/Lt2KWblS8MyATzexOXg7UqX30mfhdcNSCH4cW139F/h+J9tpZ9ks7zBOPFNFC SXuMYWeA2N2MJW9za1Rtlx8lZSjzqX4dv2lkThcsEHCTbLorpaSPmBHrWmoK4D85BKGN NHsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=h7dpMCZK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id f12-20020a170902ce8c00b001c0c79b3869si4030728plg.578.2023.10.12.20.07.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 20:07:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=h7dpMCZK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 3469C809475D; Thu, 12 Oct 2023 20:06:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229436AbjJMDFv (ORCPT + 99 others); Thu, 12 Oct 2023 23:05:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbjJMDFr (ORCPT ); Thu, 12 Oct 2023 23:05:47 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4498091 for ; Thu, 12 Oct 2023 20:05:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697166299; 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=3zDrSwzdAeWMb/6P4lK++T4MCrJYZFn5wg8AsD0sQBw=; b=h7dpMCZKqkum9wGdPIb6Paynw1zG2n15MiVikE6uB/UDWObSrGK8oqI6w4Nve0reVHaQPr Ovr9QuK5aiD2AqhfUrjZ7kOF79XFu0y267UCX3Q/daonDu/6xwiZq2pALqK4Z+8wxP8KIu llx9F69SmQxAEqsSUfyfCflmpYT4/mI= Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-477-DU5cjUsrOluEKYqvN-EV3A-1; Thu, 12 Oct 2023 23:04:57 -0400 X-MC-Unique: DU5cjUsrOluEKYqvN-EV3A-1 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-503c774fd61so1566480e87.3 for ; Thu, 12 Oct 2023 20:04:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697166296; x=1697771096; 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=3zDrSwzdAeWMb/6P4lK++T4MCrJYZFn5wg8AsD0sQBw=; b=HTmTINHJxoXmYZlnecynfReSlgdNuuidafxhdMhRCjkIFiyHSvUK3MFYAf/vg5poBX 8Mp6OlYri1ytKncg35aNp/z21DJov3mUy7u3Z1zAcSQsUcgXY30RRyxy9+stHVU0GBAY owv5Sm+EXG40TudnA6Evw8feql7qifT8gz+Qb4FkUAbA8JIlwN9xrjAQQ78ca8smj2pd UPpag3eHJnBnoOnu5n5Y0AyoN0C6w4Oa/CiNcApnuF1tKW55gd4j2lf1Q+0mJsMifqw5 heWAo4N8NUbFQlJGUGSHm2nvLK3TOwNWlmCNIvvt0y8K8gcwN9LdBZjTiurHdbGVESoi UZRQ== X-Gm-Message-State: AOJu0Yx5bWhgWRMQ7UOQfRXU4h8+HLTYxKi0WjtBKLadjc+b1L/4kic8 Fl6zUXT+IMcSync/k6da7Zevq7hBYPz3/E7enTIYplPi5V2mRSlmTfReLHizFGIPa1tlL4A5zwc Q6zVsWRVhGzMOsS+C0ep6caD3vwlTVOGggnO2bs4l X-Received: by 2002:a05:6512:220b:b0:500:a66b:b189 with SMTP id h11-20020a056512220b00b00500a66bb189mr27156027lfu.51.1697166296492; Thu, 12 Oct 2023 20:04:56 -0700 (PDT) X-Received: by 2002:a05:6512:220b:b0:500:a66b:b189 with SMTP id h11-20020a056512220b00b00500a66bb189mr27156017lfu.51.1697166296198; Thu, 12 Oct 2023 20:04:56 -0700 (PDT) MIME-Version: 1.0 References: <1696928580-7520-1-git-send-email-si-wei.liu@oracle.com> <1696928580-7520-5-git-send-email-si-wei.liu@oracle.com> In-Reply-To: <1696928580-7520-5-git-send-email-si-wei.liu@oracle.com> From: Jason Wang Date: Fri, 13 Oct 2023 11:04:45 +0800 Message-ID: Subject: Re: [PATCH 4/4] vdpa/mlx5: implement .reset_map driver op To: Si-Wei Liu Cc: mst@redhat.com, eperezma@redhat.com, xuanzhuo@linux.alibaba.com, dtatulea@nvidia.com, virtualization@lists.linux-foundation.org, linux-kernel@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 howler.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 (howler.vger.email [0.0.0.0]); Thu, 12 Oct 2023 20:06:08 -0700 (PDT) On Tue, Oct 10, 2023 at 5:05=E2=80=AFPM Si-Wei Liu = wrote: > > Since commit 6f5312f80183 ("vdpa/mlx5: Add support for running with > virtio_vdpa"), mlx5_vdpa starts with preallocate 1:1 DMA MR at device > creation time. This 1:1 DMA MR will be implicitly destroyed while > the first .set_map call is invoked, in which case callers like > vhost-vdpa will start to set up custom mappings. When the .reset > callback is invoked, the custom mappings will be cleared and the 1:1 > DMA MR will be re-created. > > In order to reduce excessive memory mapping cost in live migration, > it is desirable to decouple the vhost-vdpa IOTLB abstraction from > the virtio device life cycle, i.e. mappings can be kept around intact > across virtio device reset. Leverage the .reset_map callback, which > is meant to destroy the regular MR on the given ASID and recreate the > initial DMA mapping. That way, the device .reset op can run free from > having to maintain and clean up memory mappings by itself. > > The cvq mapping also needs to be cleared if is in the given ASID. > > Co-developed-by: Dragos Tatulea > Signed-off-by: Dragos Tatulea > Signed-off-by: Si-Wei Liu I wonder if the simulator suffers from the exact same issue. If yes, let's fix the simulator as well? Thanks