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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C632AC433EF for ; Fri, 19 Nov 2021 13:43:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A5613610D2 for ; Fri, 19 Nov 2021 13:43:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235530AbhKSNqK (ORCPT ); Fri, 19 Nov 2021 08:46:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:45756 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235424AbhKSNqJ (ORCPT ); Fri, 19 Nov 2021 08:46:09 -0500 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (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 97F5661AA3; Fri, 19 Nov 2021 13:43:07 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mo4AT-006YRA-A3; Fri, 19 Nov 2021 13:43:05 +0000 Date: Fri, 19 Nov 2021 13:43:04 +0000 Message-ID: <87bl2g6z2v.wl-maz@kernel.org> From: Marc Zyngier To: Sai Prakash Ranjan Cc: Will Deacon , , Catalin Marinas , , , , , , , , Prasad Sodagudi Subject: Re: [PATCHv4 1/2] tracing: Add register read/write tracing support In-Reply-To: <4bd519d008cac6b319be7c5ce144e741f7210031.1636973694.git.quic_saipraka@quicinc.com> References: <4bd519d008cac6b319be7c5ce144e741f7210031.1636973694.git.quic_saipraka@quicinc.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: quic_saipraka@quicinc.com, will@kernel.org, rostedt@goodmis.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, gregkh@linuxfoundation.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, psodagud@codeaurora.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 15 Nov 2021 11:33:29 +0000, Sai Prakash Ranjan wrote: > > From: Prasad Sodagudi > > Generic MMIO read/write i.e., __raw_{read,write}{b,l,w,q} accessors > are typically used to read/write from/to memory mapped registers > and can cause hangs or some undefined behaviour in following few > cases, > > * If the access to the register space is unclocked, for example: if > there is an access to multimedia(MM) block registers without MM > clocks. > > * If the register space is protected and not set to be accessible from > non-secure world, for example: only EL3 (EL: Exception level) access > is allowed and any EL2/EL1 access is forbidden. > > * If xPU(memory/register protection units) is controlling access to > certain memory/register space for specific clients. > > and more... > > Such cases usually results in instant reboot/SErrors/NOC or interconnect > hangs and tracing these register accesses can be very helpful to debug > such issues during initial development stages and also in later stages. > > So use ftrace trace events to log such MMIO register accesses which > provides rich feature set such as early enablement of trace events, > filtering capability, dumping ftrace logs on console and many more. > > Sample output: > > rwmmio_read: gic_peek_irq+0xd0/0xd8 readl addr=0xffff800010040104 > rwmmio_write: gic_poke_irq+0xe4/0xf0 writel addr=0xffff800010040184 > rwmmio_read: gic_do_wait_for_rwp+0x54/0x90 readl addr=0xffff800010040000 > rwmmio_write: gic_set_affinity+0x1bc/0x1e8 writeq addr=0xffff800010046130 > > Signed-off-by: Prasad Sodagudi > [saiprakash: Rewrote commit msg and trace event field edits] > Signed-off-by: Sai Prakash Ranjan > --- > > Have dropped value parameter for mmio write trace event as that > was causing hangs in strange ways, i.e., if we pass any other > 64bit value, it works fine but passing value would just hang. > Not just using the log apis, even simple trace_printk with value > printed would cause hang. It wasn't noticed in early version > because dyndbg would filter the logging in my system (I had > set it to trace only specific qcom directory) but once this > version starts recording all the reads/writes with value passed, > it just hangs system when rwmmio write event tracing is enabled. Why is that so? Not being able to track the value written out makes the feature pretty useless if you're not writing fixed values. > Reason why we wouldn't need value along with mmio write log is > that value can be easily deduced from the caller_name+offset which is > printed already by the rwmmio trace events which gives the exact > location of mmio writes and the value is easily known from the driver. That's a very narrow view of what can be written in an MMIO registers. We write dynamic values at all times, and if we are able to trace MMIO writes, then the value written out must be part of the trace. I'd rather you try and get to the bottom of this issue rather than paper over it. Thanks, M. -- Without deviation from the norm, progress is not possible.