Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp216766rdh; Wed, 25 Oct 2023 23:18:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEQljwTprrhNLcMKk556SEfD+pSnifLcFakA7kv/yrdDs7yDcVQiqOBpz/jN3M9kaUMRz/h X-Received: by 2002:a67:ac4c:0:b0:457:cd5d:6ab5 with SMTP id n12-20020a67ac4c000000b00457cd5d6ab5mr18223826vsh.23.1698301087480; Wed, 25 Oct 2023 23:18:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698301087; cv=none; d=google.com; s=arc-20160816; b=SwR4CAJzAiLx6Jrd5XdHOHDufapVkAsLo86c/tWQ59QhxgGWrrGPSVKhwWguqN3ZhL erVl8MUvy066rack05rughr3y8SZEzyDbCa+tV6WwJAaZ6ChD6js/aQ78spBZvBUCrmN 7UAHJEa4Oaf6mfT+AOcBRTTZZyoPdiGwr2Bns6TuciT5KkmRWy0sw179GjCQpXyTotMU XOhMYwJ/yf1ZMGqzRtXXLwcnUcOQbSuPSJCH+j6BMZXvOXYz8tOLWhq/hZOEEgIMVgg1 o8h/4lsSLKyhLH+1U3JChGXJy8yohIriplzXRhcFFQXTY/830ybDWUdC7r7fxdMhbT4s ipxA== 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=oSoYwXwDaWvend7uoRzR2H59PFDteSQmgU5j/n0TQOM=; fh=tIUQnclcMu5uH0cMrEmEgENkZ7nrjNNHdZPkLJL/JmI=; b=DjQp2rJMqWFM56JWmzAuppt6QYSoSbKfgvOOZJtgydIQKFWwaBjRFPPH59pCC6xc1x amEe/Au/tTxpLwygGcd4lbuUIrkTsEhD9nDXe7DhFfai3+zrSzlG3qIWF+vo3NZWwDTz 7JvgkSy7AdkRE5TI7TNjH4cvmvs+g2eyYGfAD7Ui18uyg0ZjjcwUlVZm0w4uB1TxVvPd St/v9smXhqnT5l/LKoW+SIu7ermjP3JocKp80q3Uw9OE0SKHnJgc1Q+5TTtoewb91K+w sHTwd7ikcgDfrG4gnOdZKoyH8zkYxxb6ZmVCcqsRl1pBdJIvh8o9CytAQyxOr0q8eLjO akSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AmuRRPfF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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. [23.128.96.34]) by mx.google.com with ESMTPS id d204-20020a25e6d5000000b00da04c537291si6045254ybh.406.2023.10.25.23.18.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 23:18:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AmuRRPfF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 EFA73811AA29; Wed, 25 Oct 2023 23:18:03 -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 S1343564AbjJZGRx (ORCPT + 99 others); Thu, 26 Oct 2023 02:17:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229638AbjJZGRw (ORCPT ); Thu, 26 Oct 2023 02:17:52 -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 93DFD115 for ; Wed, 25 Oct 2023 23:17:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698301023; 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=oSoYwXwDaWvend7uoRzR2H59PFDteSQmgU5j/n0TQOM=; b=AmuRRPfFscGf41bamjUrWGYAC42aNnjJMbtPBkCySPikpHRiInAZwvIZ6XYs5m6FsIC66r P/5GbGQOe26A60+zlnJFdOKCXGswx9gkQCmuxaR6CRhzvb0lVys5Y9q3Z+Bo3Mh70ljCxz GVh7At+DJQNzbatjQ1Af90GAADFl7y0= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-682-KepQb69YO86Dms584fSZlQ-1; Thu, 26 Oct 2023 02:17:02 -0400 X-MC-Unique: KepQb69YO86Dms584fSZlQ-1 Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-53e3120ae44so344450a12.2 for ; Wed, 25 Oct 2023 23:17:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698301020; x=1698905820; 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=oSoYwXwDaWvend7uoRzR2H59PFDteSQmgU5j/n0TQOM=; b=GrShcF7YaVaFESNL818y9nRybEzlnBnE6Zbo+iACeiJaje+vOBhwnMGGTGa8s0pwto 8M3xjzxy5j955FnHaACaCyWdxXyF5WKNqecvLhG1iSHgsMTcmGJVTPATBwsUvllL8C6s MQiuqO9cEjkOKsLeU74H9W4XbPZ5kzFusmbFORcoBbqkfysLsGp36AQiWxm1Obxsu37S LTwfZggbm9GsFw12BUsUgHE84EfaDKJVCESEkKbaFiF1QsQkVssKa8dkiPPvq3ZZW/x1 SmI8t9D3BhWEvycSEQhfEjxTxdGZy8vP4BqqIsJ6p8sQBwb8wp1/tzlIDAqFZqIiD6ZM wu6A== X-Gm-Message-State: AOJu0YymyS8CKNT/6gP6WzWqVEuyAZO7R8C6BjvRBy5VXGF6Zl9Qzuo4 kx9nKZuetu5UNXhehKOXBX5ULgAPn4RgcgK13ma2uYERtIMKMS1NVzJLyKaAeUgZGUx++KS03qm ufvCYe9NbNfBxXDKLUOv/lHKt4tlmbKcTRzNyl7s9j5Z7k7uMCP6NrQ== X-Received: by 2002:a50:d593:0:b0:53d:a0c9:dbd4 with SMTP id v19-20020a50d593000000b0053da0c9dbd4mr10983783edi.21.1698301020423; Wed, 25 Oct 2023 23:17:00 -0700 (PDT) X-Received: by 2002:a50:d593:0:b0:53d:a0c9:dbd4 with SMTP id v19-20020a50d593000000b0053da0c9dbd4mr10983770edi.21.1698301020129; Wed, 25 Oct 2023 23:17:00 -0700 (PDT) MIME-Version: 1.0 References: <1697880319-4937-1-git-send-email-si-wei.liu@oracle.com> <4d03661b-4289-46e7-8760-32a186783b73@oracle.com> In-Reply-To: From: Lei Yang Date: Thu, 26 Oct 2023 14:16:23 +0800 Message-ID: Subject: Re: [PATCH v4 0/7] vdpa: decouple reset of iotlb mapping from device reset To: Si-Wei Liu Cc: Jason Wang , mst@redhat.com, eperezma@redhat.com, sgarzare@redhat.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]); Wed, 25 Oct 2023 23:18:04 -0700 (PDT) On Thu, Oct 26, 2023 at 7:32=E2=80=AFAM Si-Wei Liu = wrote: > > Hi Yang Lei, > > Thanks for testing my patches and reporting! As for the issue, could you > please try what I posted in: > > https://lore.kernel.org/virtualization/1698275594-19204-1-git-send-email-= si-wei.liu@oracle.com/ > HI Si-Wei > and let me know how it goes? Thank you very much! This problem has gone after applying this patch [1]. [1] https://lore.kernel.org/virtualization/1698275594-19204-1-git-send-emai= l-si-wei.liu@oracle.com/ Thanks Lei > > Thanks, > -Siwei > > On 10/25/2023 2:41 AM, Lei Yang wrote: > > On Wed, Oct 25, 2023 at 1:27=E2=80=AFAM Si-Wei Liu wrote: > > Hello Si-Wei > >> Thanks a lot for testing! Please be aware that there's a follow-up fix > >> for a potential oops in this v4 series: > >> > > The first, when I did not apply this patch [1], I will also hit this > > patch mentioned problem. After I applied this patch, this problem will > > no longer to hit again. But I hit another issues, about the error > > messages please review the attached file. > > [1] https://lore.kernel.org/virtualization/1698102863-21122-1-git-send-= email-si-wei.liu@oracle.com/ > > > > My test steps: > > git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linu= x.git > > cd linux/ > > b4 am 1697880319-4937-1-git-send-email-si-wei.liu@oracle.com > > b4 am 20231018171456.1624030-2-dtatulea@nvidia.com > > b4 am 1698102863-21122-1-git-send-email-si-wei.liu@oracle.com > > git am ./v4_20231018_dtatulea_vdpa_add_support_for_vq_descriptor_mappin= gs.mbx > > git am ./v4_20231021_si_wei_liu_vdpa_decouple_reset_of_iotlb_mapping_fr= om_device_reset.mbx > > git am ./20231023_si_wei_liu_vhost_vdpa_fix_null_pointer_deref_in__comp= at_vdpa_reset.mbx > > cp /boot/config-5.14.0-377.el9.x86_64 .config > > make -j 32 > > make modules_install > > make install > > > > Thanks > > > > Lei > >> https://lore.kernel.org/virtualization/1698102863-21122-1-git-send-ema= il-si-wei.liu@oracle.com/ > >> > >> Would be nice to have it applied for any tests. > >> > >> Thanks, > >> -Siwei > >> > >> On 10/23/2023 11:51 PM, Lei Yang wrote: > >>> QE tested this series v4 with regression testing on real nic, there i= s > >>> no new regression bug. > >>> > >>> Tested-by: Lei Yang > >>> > >>> On Tue, Oct 24, 2023 at 6:02=E2=80=AFAM Si-Wei Liu wrote: > >>>> > >>>> On 10/22/2023 8:51 PM, Jason Wang wrote: > >>>>> Hi Si-Wei: > >>>>> > >>>>> On Sat, Oct 21, 2023 at 5:28=E2=80=AFPM Si-Wei Liu wrote: > >>>>>> In order to reduce needlessly high setup and teardown cost > >>>>>> of iotlb mapping during live migration, it's crucial to > >>>>>> decouple the vhost-vdpa iotlb abstraction from the virtio > >>>>>> device life cycle, i.e. iotlb mappings should be left > >>>>>> intact across virtio device reset [1]. For it to work, the > >>>>>> on-chip IOMMU parent device could implement a separate > >>>>>> .reset_map() operation callback to restore 1:1 DMA mapping > >>>>>> without having to resort to the .reset() callback, the > >>>>>> latter of which is mainly used to reset virtio device state. > >>>>>> This new .reset_map() callback will be invoked only before > >>>>>> the vhost-vdpa driver is to be removed and detached from > >>>>>> the vdpa bus, such that other vdpa bus drivers, e.g. > >>>>>> virtio-vdpa, can start with 1:1 DMA mapping when they > >>>>>> are attached. For the context, those on-chip IOMMU parent > >>>>>> devices, create the 1:1 DMA mapping at vdpa device creation, > >>>>>> and they would implicitly destroy the 1:1 mapping when > >>>>>> the first .set_map or .dma_map callback is invoked. > >>>>>> > >>>>>> This patchset is rebased on top of the latest vhost tree. > >>>>>> > >>>>>> [1] Reducing vdpa migration downtime because of memory pin / maps > >>>>>> https://www.mail-archive.com/qemu-devel@nongnu.org/msg953755.html > >>>>>> > >>>>>> --- > >>>>>> v4: > >>>>>> - Rework compatibility using new .compat_reset driver op > >>>>> I still think having a set_backend_feature() > >>>> This will overload backend features with the role of carrying over > >>>> compatibility quirks, which I tried to avoid from. While I think the > >>>> .compat_reset from the v4 code just works with the backend features > >>>> acknowledgement (and maybe others as well) to determine, but not > >>>> directly tie it to backend features itself. These two have different > >>>> implications in terms of requirement, scope and maintaining/deprecat= ion, > >>>> better to cope with compat quirks in explicit and driver visible way= . > >>>> > >>>>> or reset_map(clean=3Dtrue) might be better. > >>>> An explicit op might be marginally better in driver writer's point o= f > >>>> view. Compliant driver doesn't have to bother asserting clean_map ne= ver > >>>> be true so their code would never bother dealing with this case, as > >>>> explained in the commit log for patch 5 "vhost-vdpa: clean iotlb map > >>>> during reset for older userspace": > >>>> > >>>> " > >>>> The separation of .compat_reset from the regular .reset allow= s > >>>> vhost-vdpa able to know which driver had broken behavior befo= re, so it > >>>> can apply the corresponding compatibility quirk to the indivi= dual > >>>> driver > >>>> whenever needed. Compared to overloading the existing .reset= with > >>>> flags, .compat_reset won't cause any extra burden to the impl= ementation > >>>> of every compliant driver. > >>>> " > >>>> > >>>>> As it tries hard to not introduce new stuff on the bus. > >>>> Honestly I don't see substantial difference between these other than= the > >>>> color. There's no single best solution that stands out among the 3. = And > >>>> I assume you already noticed it from all the above 3 approaches will > >>>> have to go with backend features negotiation, that the 1st vdpa rese= t > >>>> before backend feature negotiation will use the compliant version of > >>>> .reset that doesn't clean up the map. While I don't think this nuanc= e > >>>> matters much to existing older userspace apps, as the maps should > >>>> already get cleaned by previous process in vhost_vdpa_cleanup(), but= if > >>>> bug-for-bug behavioral compatibility is what you want, module parame= ter > >>>> will be the single best answer. > >>>> > >>>> Regards, > >>>> -Siwei > >>>> > >>>>> But we can listen to others for sure. > >>>>> > >>>>> Thanks > >>>>> >