Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3734277yba; Tue, 16 Apr 2019 18:40:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqw6iEuiFbhY3iqpeJdbC9HjfXWjcOu3gLRj2qqt+XXUpoZRvLCGZZWRGbfbRF0RQpRAD9+o X-Received: by 2002:a17:902:382:: with SMTP id d2mr25021987pld.253.1555465243128; Tue, 16 Apr 2019 18:40:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555465243; cv=none; d=google.com; s=arc-20160816; b=Tw8EeRCJY5nQBxNnedgs79mOTntgCBqnCB7bm7swjOq33kNUxCvoOH4Rf+y/OjdnVe yZo8IZEV0HZ/DlvGp0lZGFF2eD52stFLz7q0Fh+fHzaNDE3ZvvG/D+8RvR8gopGlMzRT v2ePGLO7b1D5wV3/y23tRU7DdXPH6yTr9v5lx7yV/Cm2ZAU9ASbJ49aZdgVhmoVhrRyv oHOwE7DTllFDQ+1/yYx0jPSqxUlnvr+HxBICY5+8a8CYNtnJRtTKx+mFHMa0FjvY19D9 vcThZJXUs7yq18AI6E6wRPDap6r+xdgrCxLdM4CjJnxxQQ8mc5jXyLKW8+xXHR8S7Pxm JIjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=uuvi/Plk6IA3jclhIJwr/z7Rz6re0/v8v+oTt/cP0Vk=; b=rzwPvix2igIGPb+z1Hbij2rXWdemOSu4L9qNSmJHAT0aunKGwVsNDZ/0fQe4t+WxRe 68AGiqfNmA27QfGUeH6S5Sm9i2A7uBlsDwL+H8XPVFsGFguu8lgwy02SPpojOf1p/Y+6 086KNUst7nJsvIDG+RoyJWpqdfQK3qj7zCzZEjjeETKjqZKD2YT+1dwfns2mYoHKiAAf YgaKpRs3jvWizYJ5Fq9PoKPYm0iHCXDSeG1YqTVEQ7G1NZMXxtZefEYNfHeE3Zg3wyDq +6kj6ah0f+sUogH2urko/ttQgOSwZzIbmItwceFiT/h18Va1weWVa2PKGStpMlP/Usoy Kl/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d68si50729244pfg.83.2019.04.16.18.40.27; Tue, 16 Apr 2019 18:40:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729877AbfDQBjh (ORCPT + 99 others); Tue, 16 Apr 2019 21:39:37 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:6752 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728514AbfDQBjh (ORCPT ); Tue, 16 Apr 2019 21:39:37 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 40EBAA30E5ED7AF442D4; Wed, 17 Apr 2019 09:39:34 +0800 (CST) Received: from [127.0.0.1] (10.177.23.164) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.408.0; Wed, 17 Apr 2019 09:39:31 +0800 Subject: Re: [PATCH v2 0/2] iommu/arm-smmu-v3: make sure the kdump kernel can work well when smmu is enabled To: Will Deacon References: <20190318131243.20716-1-thunder.leizhen@huawei.com> <20190404153031.GE27558@fuggles.cambridge.arm.com> <5CAAB293.3080600@huawei.com> <20190416091410.GC31579@fuggles.cambridge.arm.com> CC: Jean-Philippe Brucker , Joerg Roedel , linux-kernel , iommu , Robin Murphy , linux-arm-kernel From: "Leizhen (ThunderTown)" Message-ID: <5CB683D2.9010901@huawei.com> Date: Wed, 17 Apr 2019 09:39:30 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20190416091410.GC31579@fuggles.cambridge.arm.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.23.164] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/4/16 17:14, Will Deacon wrote: > On Mon, Apr 08, 2019 at 10:31:47AM +0800, Leizhen (ThunderTown) wrote: >> On 2019/4/4 23:30, Will Deacon wrote: >>> On Mon, Mar 18, 2019 at 09:12:41PM +0800, Zhen Lei wrote: >>>> v1 --> v2: >>>> 1. Drop part2. Now, we only use the SMMUv3 hardware feature STE.config=0b000 >>>> (Report abort to device, no event recorded) to suppress the event messages >>>> caused by the unexpected devices. >>>> 2. rewrite the patch description. >>> >>> This issue came up a while back: >>> >>> https://lore.kernel.org/linux-pci/20180302103032.GB19323@arm.com/ >>> >>> and I'd still prefer to solve it using the disable_bypass logic which we >>> already have. Something along the lines of the diff below? >> >> Yes, my patches also use disable_bypass=1(set ste.config=0b000). If >> SMMU_IDR0.ST_LEVEL=0(Linear Stream table supported), then all STE entries >> are allocated and initialized(set ste.config=0b000). But if SMMU_IDR0.ST_LEVEL=1 >> (2-level Stream Table), we only allocated and initialized the first level tables, >> but leave level 2 tables dynamic allocated. That means, C_BAD_STREAMID(eventid=0x2) >> will be reported, if an unexpeted device access memory without reinitialized in >> kdump kernel. > > So is your problem just that the C_BAD_STREAMID events are noisy? If so, > perhaps we should be disabling fault reporting entirely in the kdump kernel. > > How about the update diff below? I'm keen to have this as simple as > possible, so we don't end up introducing rarely tested, complex code on > the crash path. In theory, it can solve the problem, let me test it. But then again, below patch will also disable the fault reporting come from the expected devices which are used in the kdump kernel. In fact, my patches have been merged into our interval version more than 2 months, no bug have been found yet. However, my patches do not support the case that the hardware does not support the "STE bypass" feature, I think your patch can also resolve it. > > Will > > --->8 > > diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c > index d3880010c6cf..d8b73da6447d 100644 > --- a/drivers/iommu/arm-smmu-v3.c > +++ b/drivers/iommu/arm-smmu-v3.c > @@ -2454,13 +2454,9 @@ static int arm_smmu_device_reset(struct arm_smmu_device *smmu, bool bypass) > /* Clear CR0 and sync (disables SMMU and queue processing) */ > reg = readl_relaxed(smmu->base + ARM_SMMU_CR0); > if (reg & CR0_SMMUEN) { > - if (is_kdump_kernel()) { > - arm_smmu_update_gbpa(smmu, GBPA_ABORT, 0); > - arm_smmu_device_disable(smmu); > - return -EBUSY; > - } > - > dev_warn(smmu->dev, "SMMU currently enabled! Resetting...\n"); > + WARN_ON(is_kdump_kernel() && !disable_bypass); > + arm_smmu_update_gbpa(smmu, GBPA_ABORT, 0); > } > > ret = arm_smmu_device_disable(smmu); > @@ -2553,6 +2549,8 @@ static int arm_smmu_device_reset(struct arm_smmu_device *smmu, bool bypass) > return ret; > } > > + if (is_kdump_kernel()) > + enables &= ~(CR0_EVTQEN | CR0_PRIQEN); > > /* Enable the SMMU interface, or ensure bypass */ > if (!bypass || disable_bypass) { > > . > -- Thanks! BestRegards