Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2640682pxa; Mon, 17 Aug 2020 15:13:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXBQKrbaFEuJYzekNOSxu/GQ+bFPAOHeF6yLvjaXk337ZP/9MRLJOrJeHJlm2D01z4Ekup X-Received: by 2002:a05:6402:74a:: with SMTP id p10mr17257446edy.348.1597702379904; Mon, 17 Aug 2020 15:12:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597702379; cv=none; d=google.com; s=arc-20160816; b=fOBJ+Gst24joSNZz0wxe1nrg3DpMa1AIzbYvwfqPme8nq+36v0ABVsupU1vCKIWIRY eAwzBkeabn/sDSJW8jG+lJmOCpekKs/bbe914OxQIGfBsXpQFRCmPc92s/LaLVkilIEn g1sdSQ1qJN9uqDzcAtqDWBgBryaNnt9RWRyeQzuhAvusQkp2K/UX3XolbrQE+o8khFw1 mM3YoqIhjNQtWnLX65twpnNlg2x/08cylecqvktAlPnRR52cAVw2yt8yHBFBS+d0cJxj XaDe576stEtKHkuzN4XncwwvrujCpPIqjj2XC8EBAjU4AiRoH4Hds+l9p/M6Eh8yiZ3u 4jfw== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=E200CPyDp32w5ImuVD19eXNmEiQX8EoslKqxNlWPtfY=; b=RJh8Y0vyBO9Q1PUDaaLzCQSMxm6TSl83KJ/Rvuaq15eg97SaRqKbeoLFmARgOoUUcZ 8JYRdyI7prOhva2EYzESJF0M4mL2/hkdNl45CkgukOrJAbR1n3E4Vtp49yq4aIVtIz/z HU0KYEI3R8tosTNvkaiG7iFXh6pJJZTa3PGe2PwJAwpFD4RBYQOqeq0NaRNxueJ5GrLh 0tyxHJTLSPG7CzjQK3hFbpOnky/GvJPb8+XeLGN+Ix98lvR/SZvuCGHyvJGIfN1djjhi wC64XRgGA+60Zzcwa/qkN32fE0lYvBd1VYicx0GQvACLRMQpzWo0I1u+U6UdbJ0fJAxo CK4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Kg88YTxN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d23si11662387edr.58.2020.08.17.15.12.36; Mon, 17 Aug 2020 15:12:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Kg88YTxN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388479AbgHQQwj (ORCPT + 99 others); Mon, 17 Aug 2020 12:52:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:50410 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730891AbgHQQCz (ORCPT ); Mon, 17 Aug 2020 12:02:55 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5AA282053B; Mon, 17 Aug 2020 16:02:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597680172; bh=jWqRiW4I0WKBGrfTOQRfUOvpMlfAxLk4XnkZZTMCiq8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kg88YTxNdSCihKGH0xUKYBUPXhA+ZPIr4rGx6T6GKEvOSrR7k/RsnN5lUxWX/X+x+ kYQXYXlfVLtwi8wyNN8ToI6y0BfXT1FZkOp9M5305YAhBHqF6J4xBTVPBM0ScLoaXB 32oAN6uvPzTPBNXiYmBPK78cEZVwmvwQpBGGhJlc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Osipenko , Thierry Reding , Sasha Levin Subject: [PATCH 5.4 080/270] gpu: host1x: debug: Fix multiple channels emitting messages simultaneously Date: Mon, 17 Aug 2020 17:14:41 +0200 Message-Id: <20200817143759.752045633@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143755.807583758@linuxfoundation.org> References: <20200817143755.807583758@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dmitry Osipenko [ Upstream commit 35681862808472a0a4b9a8817ae2789c0b5b3edc ] Once channel's job is hung, it dumps the channel's state into KMSG before tearing down the offending job. If multiple channels hang at once, then they dump messages simultaneously, making the debug info unreadable, and thus, useless. This patch adds mutex which allows only one channel to emit debug messages at a time. Signed-off-by: Dmitry Osipenko Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin --- drivers/gpu/host1x/debug.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/host1x/debug.c b/drivers/gpu/host1x/debug.c index c0392672a8421..1b4997bda1c79 100644 --- a/drivers/gpu/host1x/debug.c +++ b/drivers/gpu/host1x/debug.c @@ -16,6 +16,8 @@ #include "debug.h" #include "channel.h" +static DEFINE_MUTEX(debug_lock); + unsigned int host1x_debug_trace_cmdbuf; static pid_t host1x_debug_force_timeout_pid; @@ -52,12 +54,14 @@ static int show_channel(struct host1x_channel *ch, void *data, bool show_fifo) struct output *o = data; mutex_lock(&ch->cdma.lock); + mutex_lock(&debug_lock); if (show_fifo) host1x_hw_show_channel_fifo(m, ch, o); host1x_hw_show_channel_cdma(m, ch, o); + mutex_unlock(&debug_lock); mutex_unlock(&ch->cdma.lock); return 0; -- 2.25.1