Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp186460rwi; Wed, 12 Oct 2022 18:20:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5byKawNwIKEwXKWRhNFMGdj3tW+x0e6Pme9+B3o29BcyjFw7WP5PNpSmWRZyKk5wUpfWWa X-Received: by 2002:a17:907:74e:b0:74f:83d4:cf58 with SMTP id xc14-20020a170907074e00b0074f83d4cf58mr24944413ejb.178.1665624015913; Wed, 12 Oct 2022 18:20:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665624015; cv=none; d=google.com; s=arc-20160816; b=YUOWHGk/8h+BY/aYRE+KV/5IIq8AE1xULK0w+HuRr/POmhVM5DFAxqXt/fgEZ8DDMe FQTUwgWOYB8Lh2hLt0MAbwtZtiFqebvtqqXkTjes1I9DogflExQIThbsClJK9rVUt2jY 5u9y1rDNoT1oB602cyODAbmKiXwliJoJCEr7cagpZgoWTZeE7ridPE86nYcVUVhR6SRi fPNTxGXdTh8iinS/cz2czokCdPn4t24pT9bmpg8Q+nx8xhTu8vSsvAd4n92lHXNauWfJ gytp7KWRa6hoa5/OzPVtc9v9H9ita60ts4YjFfa6JszSdNL7v67tCGWOvE4+etmbnM7t MdwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:to:subject:cc:user-agent:mime-version :date:message-id:dkim-signature; bh=ec8t8Xn/l+ervk2U0GyROg9bmlrM0WIxBfRn58Se9h4=; b=ReoWFgiNLBwpysF+fj9JuRzTyVdspIXsWGJGTVYfLP+jvpHdQXBAGDpeYl5BRog07/ SRvnnzEJC6WhWJD/o9TXboa1Xpf3vkTEe9MUtvTcpZarNwXj9eJs52fBhQ0Gp1qsta/n jYRwlJD2cS/6kBdLn/R2AMWiMRdhJC9TiKJPcVLyifS70MA+4p4bxIE9XLMtAwcwyIAq EFyI/OzElTyhfFo/zdv66F8Z8KiMmCtz668MN3hmD9IN9rVLaOMuYbXSUt8aQNSwBSOU FyD09RFEU3jkyzNpAb/cWxMJX+a4r8dRrxYoF9/7kvaJZBRJsiVapgB+1tNDspClHqzT 4Aqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fqAgK3YD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j20-20020a508a94000000b00457c8bad864si15578642edj.452.2022.10.12.18.19.50; Wed, 12 Oct 2022 18:20:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fqAgK3YD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229783AbiJMBKg (ORCPT + 99 others); Wed, 12 Oct 2022 21:10:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229619AbiJMBKM (ORCPT ); Wed, 12 Oct 2022 21:10:12 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 214E612EA5D for ; Wed, 12 Oct 2022 18:08:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665623307; x=1697159307; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=sI7uA/BF8g87pdoZDXo20zv0ZMkz5SEoNiAKN8ktSaI=; b=fqAgK3YDNQeDBFU1wM2WIQzVPPTnkOkKEHTJeQyJMjIdM9Kqf+nmR9Kr 6aQRwvqksWH88Rh4KNN77cG14S4BBisYF/a7c5WxXi6fv3MiVKkSvUSSa DQt6omTBGxNZuhZ94IvUvg/UREeNP5pW9XTrIq2dtgt9ED9E+z/msQP1V 0sbeTokHlHx7JPMc6ls69E0uzG+DDU5s5pBUbC92PXF4XJEDbB5XT1cnk WjwONhm3SM2n5XPMvlOf/lfSZP8wWk5eL6XIvUdTGnBXFVgv/Vwq83C+X rvxVssOrOozEKhbTKjc6VBQ4ikrTwEunIBR5LkJfPTyKuuzIHk1vSa9jz Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10498"; a="284674726" X-IronPort-AV: E=Sophos;i="5.95,180,1661842800"; d="scan'208";a="284674726" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2022 18:08:11 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10498"; a="621972685" X-IronPort-AV: E=Sophos;i="5.95,180,1661842800"; d="scan'208";a="621972685" Received: from blu2-mobl3.ccr.corp.intel.com (HELO [10.254.210.100]) ([10.254.210.100]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2022 18:08:07 -0700 Message-ID: <9f3acdbc-26a5-46a1-bdbf-0a66bb7b43dd@linux.intel.com> Date: Thu, 13 Oct 2022 09:08:05 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.2 Cc: baolu.lu@linux.intel.com, joro@8bytes.org, will@kernel.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kevin.tian@intel.com, suravee.suthikulpanit@amd.com, vasant.hegde@amd.com, mjrosato@linux.ibm.com, schnelle@linux.ibm.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 05/16] iommu: Move bus setup to IOMMU device registration To: Alex Williamson , Robin Murphy References: <20221012102841.478c2b3b.alex.williamson@redhat.com> Content-Language: en-US From: Baolu Lu In-Reply-To: <20221012102841.478c2b3b.alex.williamson@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Alex, On 2022/10/13 0:28, Alex Williamson wrote: > On Mon, 15 Aug 2022 17:20:06 +0100 > Robin Murphy wrote: > >> Move the bus setup to iommu_device_register(). This should allow >> bus_iommu_probe() to be correctly replayed for multiple IOMMU instances, >> and leaves bus_set_iommu() as a glorified no-op to be cleaned up next. >> >> At this point we can also handle cleanup better than just rolling back >> the most-recently-touched bus upon failure - which may release devices >> owned by other already-registered instances, and still leave devices on >> other buses with dangling pointers to the failed instance. Now it's easy >> to clean up the exact footprint of a given instance, no more, no less. >> >> Tested-by: Marek Szyprowski >> Reviewed-By: Krishna Reddy >> Reviewed-by: Kevin Tian >> Tested-by: Matthew Rosato # s390 >> Tested-by: Niklas Schnelle # s390 >> Signed-off-by: Robin Murphy >> --- >> >> v4: Factor out the ops check in iommu_device_register() to keep the loop >> even simpler, and comment the nominal change in behaviour >> >> drivers/iommu/iommu.c | 55 +++++++++++++++++++++++-------------------- >> 1 file changed, 30 insertions(+), 25 deletions(-) > This introduces the below lockdep spat regression, bisected to commit: > > 57365a04c921 ("iommu: Move bus setup to IOMMU device registration") > > This can be reproduced with simple vfio-pci device assignment to a VM > on x86_64 with VT-d. Thanks, Thank you for reporting this. I have proposed below fix: https://lore.kernel.org/all/20220927053109.4053662-1-baolu.lu@linux.intel.com/ Does it work for you? Best regards, baolu