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 51527C433EF for ; Mon, 7 Mar 2022 10:20:26 +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:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=h/SAb3qBUS/FSaR+NPfA/Bv8AvxkL73XY9aUtXVjfSs=; b=rLyor6g22PWiyU AhMQn+W3diR849uzcfuG83vDmvCx2IKazt4jD8o0SEzX5kzQHpZWeCJgDZfdx3t6FFK5n8u4cd3Zt 0qF6xKFh4totL19VRiDI7PBPzZMWfhzsFFVL7QoRbGAgNn64nS7/nYGCePRHFcnypGIcMhB/rRISb 5FWMYBjvPf7XuzwzFG0ZYqmcVmAe0e5nsvHWDS6PzTSmgyYX7sp4jWJ7UZ1bSzI46mfiL9VRDAZu0 6MPehpcwyTT53VUteWvy1D4gK6LCUdZV/Esq/TdF5blSAhDM6XNp7dma5gJV6ZIim1VRjjJROSkk3 lZIo0rda83ngbbQA8kcg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRASU-00H3Pc-EZ; Mon, 07 Mar 2022 10:19:18 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRASQ-00H3NC-Qb for linux-arm-kernel@lists.infradead.org; Mon, 07 Mar 2022 10:19:16 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D28B2ED1; Mon, 7 Mar 2022 02:19:11 -0800 (PST) Received: from lpieralisi (unknown [10.57.39.63]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EE0CB3F73D; Mon, 7 Mar 2022 02:19:10 -0800 (PST) Date: Mon, 7 Mar 2022 10:19:07 +0000 From: Lorenzo Pieralisi To: Aristeu Rozanski Cc: Robin Murphy , Will Deacon , Catalin Marinas , linux-arm-kernel@lists.infradead.org Subject: Re: ??? FAIL: Test report for kernel 5.13.0-rc7 (arm-next, 8ab9b1a9) Message-ID: References: <31ffe8fc-f5ee-2858-26c5-0fd8bdd68702@arm.com> <20210625110944.GB20835@arm.com> <48b23351-3dba-bec8-242f-3c918ae55708@arm.com> <8a28663f-6541-6ff4-3de0-b140e3f8a5b9@arm.com> <20210629144415.GA28457@lpieralisi> <14ca6f72-9b0f-ebd7-9cf8-a5d6190c8e5d@arm.com> <7c058806-6967-5df9-2a33-b8f9be0d2a5f@arm.com> <20220304193920.kj3mvrguepklgb3m@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220304193920.kj3mvrguepklgb3m@redhat.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220307_021915_016328_99376B5A X-CRM114-Status: GOOD ( 33.78 ) 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 On Fri, Mar 04, 2022 at 02:39:20PM -0500, Aristeu Rozanski wrote: > Hi Robin, > > (Old thread, so reference to it: https://lists.infradead.org/pipermail/linux-arm-kernel/2021-June/668228.html) > (Also, please keep me on Cc since I'm not subscribed to linux-arm) > (And again because I failed to fix the email address after using the > archives mailbox, apologies for that) > > On Tue, Jun 29, 2021 at 06:27:57PM +0100, Robin Murphy wrote: > > Ah, from that I can only assume that this must be stress-ng's --sysfs > > test reading things at random, so not only would it have to be on a > > machine whose firmware presents the right thing in the right way but the > > random test conditions would also have to line up to poke it the "right" > > (wrong) way too. > > > > As a temporary workaround for the CI flakes, might it be possible to > > configure stress-ng to stay away from just these ACPI "data" files? > > I started looking at this issue and managed to reproduce the issue > instantly with > > dd if=/sys/firmware/acpi/tables/data/BERT of=/dev/null bs=7 > > I've attempted a few ways of fixing it based on the comments on this > thread but wasn't successful so far (my knowledge is pretty limited in > this area too, so not a big surprise). How can I be of assistance to debug/test > patches for this issue? I put together the patch below that I need to send to see whether that's acceptable, if you can help me test it in the meantime, that'd great. -- >8 -- Subject: [PATCH] ACPI: osl: Fix BERT error region memory mapping Currently the sysfs interface maps the BERT error region as "memory" (through acpi_os_map_memory()) in order to copy the error records into memory buffers through memory operations (eg memory_read_from_buffer()). The OS system cannot detect whether the BERT error region is part of system RAM or it is "device memory" (eg BMC memory) and therefore it cannot detect which memory attributes the bus to memory support (and corresponding kernel mapping, unless firmware provides the required information). The acpi_os_map_memory() arch backend implementation determines the mapping attributes. On arm64, if the BERT error region is not present in the EFI memory map, the error region is mapped as device-nGnRnE; this triggers alignment faults since memcpy unaligned accesses are not allowed in device-nGnRnE regions. The ACPI sysfs code cannot therefore map by default the BERT error region with memory semantics but should use a safer default. Change the sysfs code to map the BERT error region as MMIO (through acpi_os_map_iomem()) and use the memcpy_fromio() interface to read the error region into the kernel buffer. Link: https://lore.kernel.org/linux-arm-kernel/31ffe8fc-f5ee-2858-26c5-0fd8bdd68702@arm.com Link: https://lore.kernel.org/linux-acpi/CAJZ5v0g+OVbhuUUDrLUCfX_mVqY_e8ubgLTU98=jfjTeb4t+Pw@mail.gmail.com Signed-off-by: Lorenzo Pieralisi Cc: Ard Biesheuvel Cc: Will Deacon Cc: Hanjun Guo Cc: Sudeep Holla Cc: Catalin Marinas Cc: "Rafael J. Wysocki" --- drivers/acpi/sysfs.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c index a4b638bea6f1..cc2fe0618178 100644 --- a/drivers/acpi/sysfs.c +++ b/drivers/acpi/sysfs.c @@ -415,19 +415,30 @@ static ssize_t acpi_data_show(struct file *filp, struct kobject *kobj, loff_t offset, size_t count) { struct acpi_data_attr *data_attr; - void *base; - ssize_t rc; + void __iomem *base; + ssize_t size; data_attr = container_of(bin_attr, struct acpi_data_attr, attr); + size = data_attr->attr.size; + + if (offset < 0) + return -EINVAL; + + if (offset >= size) + return 0; - base = acpi_os_map_memory(data_attr->addr, data_attr->attr.size); + if (count > size - offset) + count = size - offset; + + base = acpi_os_map_iomem(data_attr->addr, size); if (!base) return -ENOMEM; - rc = memory_read_from_buffer(buf, count, &offset, base, - data_attr->attr.size); - acpi_os_unmap_memory(base, data_attr->attr.size); - return rc; + memcpy_fromio(buf, base + offset, count); + + acpi_os_unmap_iomem(base, size); + + return count; } static int acpi_bert_data_init(void *th, struct acpi_data_attr *data_attr) -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel