Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp86845rdb; Wed, 18 Oct 2023 19:55:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE39ClLkiLwIEAIL617zC9Lhgqh/tR6sCgsI/C63Pbo3HKPEL+v8Vbjt+mmebw7GmmWAFTG X-Received: by 2002:a17:90b:48c4:b0:274:8951:b5ed with SMTP id li4-20020a17090b48c400b002748951b5edmr909149pjb.20.1697684100124; Wed, 18 Oct 2023 19:55:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697684100; cv=none; d=google.com; s=arc-20160816; b=Vk9aKCfej8U3VQiiHWljaam853rH1d10hKvi3Zdsuv5wC3CZkMGqZbHxedot7j2wN3 ivvSsbhFpm3PDTHwvYA7PdXyeRMVG5gcqyTsh6Y9K5l7z+0RhS7mOBzOCj4V5nfGckQJ qWgtXs45V7tLvNGOoiaID9DN27M4Nz7ikVMmjlvysXfqfextRS8FCDuMXZJsc5xY+10n RE2kGa7pLniVlrfXzVnADZty3zBKq0CwT8T7jGFrF4NfIODoy86/Ue6QgG5VH3Q1+gYG 27axiL+TfZ/zDRm1tm8X1TrXAsk71syDYyLWZhYPDFpgpvLOIX6YFslFDC6d+GyuRiFO QeTw== 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=YbD/Q6ufbnNB3XAdhgE8oF7W+MQMG5bePwJCf8IlXBE=; fh=PZ2/ZCPWMx2NfjbxUJvFPB8r1scu1oUFbNyLTF8kZ8k=; b=nY/FjPuM/u+hKPhGQ66UkpeAPPrkiYrY1mRji7tjDJYCiDYIP/uMiBV6acApWy/A3g gvHWWyiGdVi1Y7N3EhmDkJPXo837LdVXCAQIJVSA+5Pa9cZRwuXW6mq70ViOMxBVmoXr V3hTddn9WfYJIGWNlaXrhukTXq6cf2KZxsF8C/tPQZXBg+M23mBcj3UZiUrYR+LMM257 7VqtNfnJYxQmp7GXD3abyCoRUaO3GMbkz+mjMpvCHcXpF7oKgAgA3sFAMWeND/WP9i/b DiELcbJkDx8ewS5vfBAOttWZbWeHT6UBW2xYIbz5OKJ63DzrDNqjQ1vOO9Tde0xM2Q3C nFZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=B42Nir42; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id d24-20020a637358000000b005ab6142f1besi3335621pgn.169.2023.10.18.19.54.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 19:55:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=B42Nir42; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id 766BE81FD9C8; Wed, 18 Oct 2023 19:54:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232357AbjJSCyk (ORCPT + 99 others); Wed, 18 Oct 2023 22:54:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229632AbjJSCyj (ORCPT ); Wed, 18 Oct 2023 22:54:39 -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 0670C95 for ; Wed, 18 Oct 2023 19:53:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697684031; 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=YbD/Q6ufbnNB3XAdhgE8oF7W+MQMG5bePwJCf8IlXBE=; b=B42Nir42UNzJ+nVD9dZTkFX75Z54K5f0cbWkoTtPorZLUAxpgkNtSTlqKvvWdzd8l2YFLr /V8p5RXiuWnMmuUe8FakrJLsA9KJtuLd7AQaZ2+ZeOA67+B7bqpc/KQbJw6ODmI/YzRbjg lkw2OnD9f07YX0Fu/gq9m+Smwsp4UY4= Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-416-o-7OFhm1N52gB9xCLcjiig-1; Wed, 18 Oct 2023 22:53:44 -0400 X-MC-Unique: o-7OFhm1N52gB9xCLcjiig-1 Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-507be692ce4so2603711e87.2 for ; Wed, 18 Oct 2023 19:53:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697684023; x=1698288823; 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=YbD/Q6ufbnNB3XAdhgE8oF7W+MQMG5bePwJCf8IlXBE=; b=e7br9mMKy0T07tt+RgIAVHArA7RR9vVKOrOckXohT0APDoBtkUt3tUmi4ziojAgIXs nUULcv/QeiVKIdd4pJn61RLHgBYUL8e/iHU6/i5Vsj1zHkYDfx9O9+YeHt4Q7sfL7NBr zwP/lJw2Z4/J7L16h9GWN02CPL146SilSH7MhueHAmaJ0l7+7UwSOKJteyLTfI+cUZ0y MHeaWAx6mSMiA6AW2Omcd8+hzV+xUsNGhaIw+w3Px3DD76E3jtuOa+XlV+bLVgkopawP g+WOQbuXY1l6yB02nn3+TX2jWaLDdp4GqeVmYpvXxxg/clTOARx7qQS7IU6mIQiOYkXO TrGA== X-Gm-Message-State: AOJu0YyVw5i+OZKxn6Zc+Vl1Pghi0qHcPw1MOjygOwETviZ8YVJfZwsg TB2HLWvYcNmwkVvu8AooolSXUXBLsCdVfsfUYBU1Ngqdp6kg9mgrMutcmu3jfu6RelLY9/5nY/G lsDtr7QkD1m0hr0bw9SS+Sbgo3LBuznbUY7d481Z2 X-Received: by 2002:ac2:4c08:0:b0:503:1913:ed8e with SMTP id t8-20020ac24c08000000b005031913ed8emr421714lfq.61.1697684023489; Wed, 18 Oct 2023 19:53:43 -0700 (PDT) X-Received: by 2002:ac2:4c08:0:b0:503:1913:ed8e with SMTP id t8-20020ac24c08000000b005031913ed8emr421711lfq.61.1697684023116; Wed, 18 Oct 2023 19:53:43 -0700 (PDT) MIME-Version: 1.0 References: <1696928580-7520-1-git-send-email-si-wei.liu@oracle.com> <1696928580-7520-3-git-send-email-si-wei.liu@oracle.com> <1bd79050-8eb5-49f6-9e58-6c7eb3fcab3e@oracle.com> <8f8c0c28-59a4-489b-9276-fc3b5cfa8faa@oracle.com> In-Reply-To: From: Jason Wang Date: Thu, 19 Oct 2023 10:53:31 +0800 Message-ID: Subject: Re: [PATCH 2/4] vhost-vdpa: reset vendor specific mapping to initial state in .release To: Si-Wei Liu Cc: Eugenio Perez Martin , mst@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 fry.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 (fry.vger.email [0.0.0.0]); Wed, 18 Oct 2023 19:54:56 -0700 (PDT) On Wed, Oct 18, 2023 at 4:49=E2=80=AFPM Si-Wei Liu = wrote: > > > > On 10/18/2023 12:00 AM, Jason Wang wrote: > >> Unfortunately, it's a must to stick to ABI. I agree it's a mess but we > >> don't have a better choice. Or we can fail the probe if userspace > >> doesn't ack this feature. > > Antoher idea we can just do the following in vhost_vdpa reset? > > > > config->reset() > > if (IOTLB_PERSIST is not set) { > > config->reset_map() > > } > > > > Then we don't have the burden to maintain them in the parent? > > > > Thanks > Please see my earlier response in the other email, thanks. > > ----------------%<----------------%<---------------- > > First, the ideal fix would be to leave this reset_vendor_mappings() > emulation code on the individual driver itself, which already has the > broken behavior. So the point is, not about whether the existing behavior is "broken" or not. It's about whether we could stick to the old behaviour without too much cost. And I believe we could. And just to clarify here, reset_vendor_mappings() =3D config->reset_map() > But today there's no backend feature negotiation > between vhost-vdpa and the parent driver. Do we want to send down the > acked_backend_features to parent drivers? There's no need to do that with the above code, or anything I missed here? config->reset() if (IOTLB_PERSIST is not set) { config->reset_map() } > > Second, IOTLB_PERSIST is needed but not sufficient. Due to lack of > backend feature negotiation in parent driver, if vhost-vdpa has to > provide the old-behaviour emulation for compatibility on driver's > behalf, it needs to be done per-driver basis. There could be good > on-chip or vendor IOMMU implementation which doesn't clear the IOTLB in > .reset, and vendor specific IOMMU doesn't have to provide .reset_map, Then we just don't offer IOTLB_PRESIST, isn't this by design? > we > should allow these good driver implementations rather than > unconditionally stick to some specific problematic behavior for every > other good driver. Then you can force reset_map() with set_map() that is what I suggest in another thread, no? > Then we need a set of device flags (backend_features > bit again?) to indicate the specific driver needs upper layer's help on > old-behaviour emulation. > > Last but not least, I'm not sure how to properly emulate > reset_vendor_mappings() from vhost-vdpa layer. If a vendor driver has no > .reset_map op implemented, or if .reset_map has a slightly different > implementation than what it used to reset the iotlb in the .reset op, See above, for reset_vendor_mappings() I meant config->reset_map() exactly. Thanks > then this either becomes effectively dead code if no one ends up using, > or the vhost-vdpa emulation is helpless and limited in scope, unable to > cover all the cases. > > ----------------%<----------------%<---------------- >