From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4F2A8C46CA3 for ; Tue, 5 Dec 2023 13:26:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JLx1DQ8LxDA6BJslKs+P5MNQcil8WGlndmRBuWyi964=; b=Kaqv00cROlOaDj vlFE4w+OB2RGPmAtxUaINjpcUu/BmieFhQXG+0Zyu1wd2z5D+vMJK10rszhRYeDDdcQC+f1R5wBTX effw44YY7vbBQpAOjrjzX+ShJCOfxKNv95hzba+FpVxkrOWUnlrh2SwMzytkyZHYiZIFtI/VJKVXX 1Cg/uEqgVR9es9y/RQFgqMcI1Ev7GsXDICUua2l7Zw1Nsb+3bS9GJH6FRM8aFUpZc2E2KXM5K5W1d CRklkfa5ve9nzakI3ugJbX4y9X+Tg1c3Y+OULizo6VWvKdV90m4/e1ppRwRxAnFTQFyYt/Xe+Z78Z 7w2FDKYKb1KnCtewy5WQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rAVQh-007VEC-0d; Tue, 05 Dec 2023 13:25:39 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rAVQe-007VDe-1F for linux-arm-kernel@lists.infradead.org; Tue, 05 Dec 2023 13:25:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701782734; 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=gET9du08BmvB9xnJGl327V4v6DwSpl5CMpPFLBUY7xY=; b=EZ5+1hl9H5j73O6Z+T0TEwt73ZocQblzw+CASVn7O1apmiSToPxRPbLqdd2TeajtcqytJ7 20nGT2TADOAydFj01r/Nq7N8vv8GgsQjjj1+XBzON4s0CE/qtgMCzoCPebCfABl3QZmakO 0sbwhlTQfl5cBgemQGL1nq076NVwizg= Received: from mail-ot1-f72.google.com (mail-ot1-f72.google.com [209.85.210.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-484-obLDGh8cMyyrDYVXFnmSHg-1; Tue, 05 Dec 2023 08:25:32 -0500 X-MC-Unique: obLDGh8cMyyrDYVXFnmSHg-1 Received: by mail-ot1-f72.google.com with SMTP id 46e09a7af769-6d81f59bc46so3096198a34.3 for ; Tue, 05 Dec 2023 05:25:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701782732; x=1702387532; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=gET9du08BmvB9xnJGl327V4v6DwSpl5CMpPFLBUY7xY=; b=oSJ6YG/uhj4Ji+1BMtn7BFinV+4IRJJJ3sp+I+VWUsUpLZaLnW375pEL7fShHWWSlV jc9ZwheGFToFUx10sU3wSiOW49a9yESid2u3vEku9XuBvEMf/EgGFXLMrq7sYrnLpd9D JqhbrRXiz13Xfq1v2oizOqa5+pJ0W6sUrgnOhJAwH1QH4mHWbZyrMVTtDncGGSZZ5hcu u9ir5Zg+7nHULHr3GoiiVTQRMck/x/LowX+w4blkxvgh+SdOvLy6tdi9rjUv9vFtrQSM rJVo3KweyCVetQebQ+nI2vBerW8I1H05JLSPApvVvrOVtnlv8Sqv0CzewMuqGkoKrWKm ojLA== X-Gm-Message-State: AOJu0Yyv7DmCugYP7tvmrpB7MWt/o5BPNhIAEXk2wOTXQMCJWbnUp/qg 7LcHcgCGrmi10x84gVYjQOWnIIxZAUvqheRrxSeDnx4A0ixV+TuJ/zoLw8BCeBU0XyAOCnezljw iRpA7K9BznPpl5fcD6fBR9lenxoWncZ9vcOY= X-Received: by 2002:a05:6871:5213:b0:1fb:75b:2bb9 with SMTP id ht19-20020a056871521300b001fb075b2bb9mr3399052oac.117.1701782732132; Tue, 05 Dec 2023 05:25:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IECMAmTismgKntArm+XZeEWXmEQ5+qKaP2PKMQykRuQmVv63gLdp3/GxWzAQ2GHBy/8TwkJuA== X-Received: by 2002:a05:6871:5213:b0:1fb:75b:2bb9 with SMTP id ht19-20020a056871521300b001fb075b2bb9mr3399036oac.117.1701782731800; Tue, 05 Dec 2023 05:25:31 -0800 (PST) Received: from ?IPV6:2a01:e0a:59e:9d80:527b:9dff:feef:3874? ([2a01:e0a:59e:9d80:527b:9dff:feef:3874]) by smtp.gmail.com with ESMTPSA id s28-20020a0cb31c000000b0067a364eea86sm5139895qve.142.2023.12.05.05.25.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 Dec 2023 05:25:31 -0800 (PST) Message-ID: <8bed7afd-d180-4b71-8211-e3fb7a653b8a@redhat.com> Date: Tue, 5 Dec 2023 14:25:27 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 14/19] iommu/arm-smmu-v3: Remove arm_smmu_master->domain To: Jason Gunthorpe Cc: iommu@lists.linux.dev, Joerg Roedel , linux-arm-kernel@lists.infradead.org, Robin Murphy , Will Deacon , Michael Shavit , Nicolin Chen , Shameerali Kolothum Thodi References: <14-v2-de8b10590bf5+400-smmuv3_newapi_p1_jgg@nvidia.com> <6fff20dd-46d5-4974-a4a5-fb4e7a59ce44@redhat.com> <20231130120340.GA1124924@nvidia.com> From: Eric Auger In-Reply-To: <20231130120340.GA1124924@nvidia.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231205_052536_513588_AADAC0A5 X-CRM114-Status: GOOD ( 19.86 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Jason, On 11/30/23 13:03, Jason Gunthorpe wrote: > On Mon, Nov 27, 2023 at 06:14:30PM +0100, Eric Auger wrote: >> Hi Jason, >> >> On 11/13/23 18:53, Jason Gunthorpe wrote: >>> Introducing global statics which are of type struct iommu_domain, not >>> struct arm_smmu_domain makes it difficult to retain >>> arm_smmu_master->domain, as it can no longer point to an IDENTITY or >>> BLOCKED domain. >>> >>> The only place that uses the value is arm_smmu_detach_dev(). Change things >>> to work like other drivers and call iommu_get_domain_for_dev() to obtain >>> the current domain. >>> >>> Signed-off-by: Jason Gunthorpe >> >> This patch introduces a crash on my machine. See below. > > Ah, your system must have multi-device groups > > The master->domain was subtly protecting the domain_head to ensure > we don't touch it unless it is already in a domain list. This issue is > solved in part 2 (iommu/arm-smmu-v3: Make smmu_domain->devices into an > allocated list) which removes the domain_head. > > This hunk should fix this patch. I updated the github I confirm that the hunk hereafter fixes the crash. Thanks Eric > > diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > index 23dda64722ea17..102e13b65bcdec 100644 > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > @@ -2491,7 +2491,7 @@ static void arm_smmu_detach_dev(struct arm_smmu_master *master) > arm_smmu_disable_ats(master, smmu_domain); > > spin_lock_irqsave(&smmu_domain->devices_lock, flags); > - list_del(&master->domain_head); > + list_del_init(&master->domain_head); > spin_unlock_irqrestore(&smmu_domain->devices_lock, flags); > > master->ats_enabled = false; > @@ -2606,7 +2606,7 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) > > out_list_del: > spin_lock_irqsave(&smmu_domain->devices_lock, flags); > - list_del(&master->domain_head); > + list_del_init(&master->domain_head); > spin_unlock_irqrestore(&smmu_domain->devices_lock, flags); > > out_unlock: > @@ -2810,6 +2810,7 @@ static struct iommu_device *arm_smmu_probe_device(struct device *dev) > master->dev = dev; > master->smmu = smmu; > INIT_LIST_HEAD(&master->bonds); > + INIT_LIST_HEAD(&master->domain_head); > dev_iommu_priv_set(dev, master); > > ret = arm_smmu_insert_master(smmu, master); > > > > Thank!! > Jason > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel