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 X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 689B6C47095 for ; Mon, 7 Jun 2021 15:34:54 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 31EC1611AC for ; Mon, 7 Jun 2021 15:34:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 31EC1611AC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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=UZghcWvPmKnAoBThyyvo6fll0M0mZHSRvuYzHcpyOc0=; b=liJP04mawoBsvL FDg6tjvY//RsduK4dTxQiCRib+pIwpEA+nlxwQBUmfSqDxo2pShcXHaxvGbZ8tOcp5VemBPqNawcH N/obvlcB6EDTTJ8XFFD2gE/p0LNQbQkvrcQJ59sHzWDLxj4K81YBP48vrY+GthyhiGFDAs50m7QS3 8KgfG92iSncSnwlLI/TESlYB/Y26TI5N6oCdWbdn8rIZISYiHjXvsIAturENbq+dFR32cgHhe77FJ /RXZUSnuzHG3zzDu+upw1SEpyoMf0zQr3Plod1cc+52VXAmDCA5tSjCO82/x0TqTxQ3J7QNIFeaF5 xwKQptuGw5mmc6WoYY1A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqHFX-004GcK-KA; Mon, 07 Jun 2021 15:33:11 +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 1lqHFR-004GaU-26 for linux-arm-kernel@lists.infradead.org; Mon, 07 Jun 2021 15:33:06 +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 435B51042; Mon, 7 Jun 2021 08:33:03 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.4.24]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1C0633F694; Mon, 7 Jun 2021 08:33:00 -0700 (PDT) Date: Mon, 7 Jun 2021 16:32:47 +0100 From: Mark Rutland To: Arnd Bergmann Cc: Will Deacon , emma@anholt.net, mripard@kernel.org, Marek Szyprowski , linux-arm-kernel@lists.infradead.org, kernel-team@android.com, Catalin Marinas , Ard Biesheuvel , Vincent Whitchurch , Bartlomiej Zolnierkiewicz , dri-devel Subject: Re: [PATCH] arm64: cache: Lower ARCH_DMA_MINALIGN to 64 (L1_CACHE_BYTES) Message-ID: <20210607153247.GA6716@C02TD0UTHF1T.local> References: <4d0c8318-bad8-2be7-e292-fc8f70c198de@samsung.com> <20210602135123.GD12753@C02TD0UTHF1T.local> <130ce34f-460a-0046-f722-00144f2d5502@samsung.com> <20210604100114.GC64162@C02TD0UTHF1T.local> <0d10411d-49fe-fbca-0479-e2983af16aa8@samsung.com> <20210607120118.GC97489@C02TD0UTHF1T.local> <20210607130859.GD97489@C02TD0UTHF1T.local> <20210607133953.GB7330@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210607_083305_228214_43D9BBFA X-CRM114-Status: GOOD ( 22.64 ) 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 Mon, Jun 07, 2021 at 03:57:41PM +0200, Arnd Bergmann wrote: > On Mon, Jun 7, 2021 at 3:39 PM Will Deacon wrote: > > > > [Adding VC4 folks -- please see the KASAN splat below!] > > > > Background here is that reducing ARCH_DMA_MINALIGN to 64 on arm64 (queued in > > -next) is causing vc4 to hang on Rpi3b due to a probable driver bug. > > The great news for the patch that caused it is that this has nothing to > do with DMA alignment. > > > On Mon, Jun 07, 2021 at 02:08:59PM +0100, Mark Rutland wrote: > > > On Mon, Jun 07, 2021 at 01:01:18PM +0100, Mark Rutland wrote: > > > > On Mon, Jun 07, 2021 at 11:58:32AM +0200, Marek Szyprowski wrote: > > > > [ 3.728042] BUG: KASAN: slab-out-of-bounds in vc4_atomic_commit_tail+0x1cc/0x910 > > > [ 3.728123] Read of size 8 at addr ffff000007360440 by task kworker/u8:0/7 > > This is offset 0x40 into struct vc4_hvs_state, which is the > 'pending_commit' pointer > for the array index 4, i.e. one after the end of the structure. > > > > [ 3.728495] kasan_report+0x1dc/0x240 > > > [ 3.728529] __asan_load8+0x98/0xd4 > > > [ 3.728565] vc4_atomic_commit_tail+0x1cc/0x910 > > It seems to be this loop: > > for_each_old_crtc_in_state(state, crtc, old_crtc_state, i) { > struct vc4_crtc_state *vc4_crtc_state = > to_vc4_crtc_state(old_crtc_state); > unsigned int channel = vc4_crtc_state->assigned_channel; > int ret; > > if (channel == VC4_HVS_CHANNEL_DISABLED) > continue; > > if (!old_hvs_state->fifo_state[channel].in_use) > continue; > > ret = > drm_crtc_commit_wait(old_hvs_state->fifo_state[i].pending_commit); > if (ret) > drm_err(dev, "Timed out waiting for commit\n"); > } > > I notice that it checks index 'fifos_state[channel].in_use', but then > uses a different index 'i' for looking at the 'pending_commit' field > beyond the end of the array. FWIW, with that drm_crtc_commit_wait() call changed to: | ret = drm_crtc_commit_wait(old_hvs_state->fifo_state[channel].pending_commit); ... I no longer see a KASAN splat, and I no longer see a hang with ARCH_DMA_MINALIGN reduced to 64. Thanks, Mark. > > This code was introduced by Maxime Ripard in commit 9ec03d7f1ed3 > ("drm/vc4: kms: Wait on previous FIFO users before a commit"). > > Arnd _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel