Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5173898ybl; Wed, 22 Jan 2020 11:41:23 -0800 (PST) X-Google-Smtp-Source: APXvYqwqzJc+vBKAkWKzLG3nXmq3tQBRo7CLihiydFZUTTt2GjCi8J9/T9/B95X0c8fTTQ8EdRzD X-Received: by 2002:a05:6830:1e46:: with SMTP id e6mr8308806otj.245.1579722083142; Wed, 22 Jan 2020 11:41:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579722083; cv=none; d=google.com; s=arc-20160816; b=z1bSo/AlHA/R8iAAxAkL2phONqwGXGHLfrTHDhujkpWVNkfTKrhieU/Gjgxee7kD3q oW4eORuAwkv/l5JLxCz8jK+wTXsBdIkZ/SCajYjR4REau72pyi2mPyqqoRBZdHf7hBCR GiPM7qxfqlXexeiWLdxANyjekXA/087BGI5PjWxM3AMDeLTt8a6Y5NwBw22IziQK32OC VFvCfD2aw7f5F+G+7bTL/OzERxE4V1n+gEFhhcLLuYn1Tml5dMv1jBmzvoXfSUp0jMAS SK4zMSIvwDTJC2R2T8UKHPx4nHVPk4Dw2a8rnCpfDBuxS0RF6Ll7aJiy/JxlSaBoG8OO qCpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=HtkbmR8fmtnktqo3yHC3XtDswDNTkwK2QM7gBaKydjo=; b=wKcqMgzJPg7zpu/8JqoOffLCHM0H1+e4SG+gZxxRZD9AUY1ZyC98v4bjU5W8S1HAXB GTDdxPpgJ+HHTKHvrq76XcLKwN36uYdgrW2yg6KLEW2446Ndc3Tmqj3493OQYEA0NWNo wy1x2T3nJznR8NBtd93JQR8BMs/mYfv5skYbtu+7RBGwFGou0Pzl4O+KLl7U47/R96RE 6syg3EHRp/47+bMY71fq/TzzCZLMkm8/bp7xlqFbdjXkpUqOQbl54Ab8Yggi7D/z7/ul tI6DM81J1qJkP2TdRa3091oR/fk2kP4eYGpuyQDRG4CJaCdW5z/LkCECx0j15iQPqTYT UmAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LeYeH8PJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f203si21675699oib.56.2020.01.22.11.41.09; Wed, 22 Jan 2020 11:41:23 -0800 (PST) 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; dkim=pass header.i=@linaro.org header.s=google header.b=LeYeH8PJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726584AbgAVTkL (ORCPT + 99 others); Wed, 22 Jan 2020 14:40:11 -0500 Received: from mail-pj1-f65.google.com ([209.85.216.65]:40497 "EHLO mail-pj1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726205AbgAVTkL (ORCPT ); Wed, 22 Jan 2020 14:40:11 -0500 Received: by mail-pj1-f65.google.com with SMTP id bg7so402852pjb.5 for ; Wed, 22 Jan 2020 11:40:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=HtkbmR8fmtnktqo3yHC3XtDswDNTkwK2QM7gBaKydjo=; b=LeYeH8PJOdf0UULN0/CxInW7FJi07Sm9Up0Ar6Q60ZzC2HZAIMmrlzUhhT49ZV4HhR uHk+Rhe04vMUWG4wKoDXHqHfvHYhuSkur3fvP9ubsuO7qrTOroxwHjtZ2gtI08bYl1+e RfCnHgW20nX0aRlZYfzwOZcGnpWo83M5+lS82TrsmEoGqv6koy/K3QgZIZ7PqPib4weT MVY0zuhLIqcehSAkwrBcjtGCfeecyudS5Ae6UkO6DfnkUrznAiCTJ+InoYHt7MLXQySb cQKPgu8cE9uivRq5C1dm6MGOHSmr8lMw+zRLs3mK7QaWn0mItWF3h426tUKW65vXygO0 JZmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=HtkbmR8fmtnktqo3yHC3XtDswDNTkwK2QM7gBaKydjo=; b=l6Z3g4IoD8X4kU2M+UK01Cl0U+73H9XOA4xuUjnFyi7Q6GPM8t6r6X3RNf/fQXg6BS V76P8tVxXsTVQNf7e/kLybGM3JRQxh/GuuIciYOOk9dHKVGCBhh1o18k4isjL/Fm7rxe IqbnawgEsnkKI3pYTgGNCbT9EVVgII0GL4XP/iTMUzL1GVMDu6yaV0O9UUThd00tejvR Xy6hx1dNuMnTApk+vGyuMottpllRud/2giVLrGQDCNyoxjso1p6sE8QNiPqTeSGjNqFU AB6vEkkBrL2rimDN3TxVSSd1kSEsvJVqRncNb/bz0kKd9Vw954Smdu8dFFTmO+OyOX9g GVYg== X-Gm-Message-State: APjAAAX1jQ7Jce1CIj70hfP8V6Xsu+7tpQhmTkTC4fvzvxD4JxFemaih uVNbf2qWPj7yqqRHUBlQa6+pag== X-Received: by 2002:a17:902:9042:: with SMTP id w2mr12495147plz.269.1579722009787; Wed, 22 Jan 2020 11:40:09 -0800 (PST) Received: from ripper (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id w8sm45848542pfn.186.2020.01.22.11.40.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2020 11:40:09 -0800 (PST) Date: Wed, 22 Jan 2020 11:39:36 -0800 From: Bjorn Andersson To: Mathieu Poirier Cc: Rob Herring , Mark Rutland , Ohad Ben-Cohen , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org, Sibi Sankar , Rishabh Bhatnagar Subject: Re: [PATCH v2 7/8] remoteproc: qcom: q6v5: Add common panic handler Message-ID: <20200122193936.GB3261042@ripper> References: <20191227053215.423811-1-bjorn.andersson@linaro.org> <20191227053215.423811-8-bjorn.andersson@linaro.org> <20200110212806.GD11555@xps15> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200110212806.GD11555@xps15> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 10 Jan 13:28 PST 2020, Mathieu Poirier wrote: > On Thu, Dec 26, 2019 at 09:32:14PM -0800, Bjorn Andersson wrote: > > Add a common panic handler that invokes a stop request and sleep enough > > to let the remoteproc flush it's caches etc in order to aid post mortem > > debugging. > > > > Signed-off-by: Bjorn Andersson > > --- > > > > Changes since v1: > > - None > > > > drivers/remoteproc/qcom_q6v5.c | 19 +++++++++++++++++++ > > drivers/remoteproc/qcom_q6v5.h | 1 + > > 2 files changed, 20 insertions(+) > > > > diff --git a/drivers/remoteproc/qcom_q6v5.c b/drivers/remoteproc/qcom_q6v5.c > > index cb0f4a0be032..17167c980e02 100644 > > --- a/drivers/remoteproc/qcom_q6v5.c > > +++ b/drivers/remoteproc/qcom_q6v5.c > > @@ -6,6 +6,7 @@ > > * Copyright (C) 2014 Sony Mobile Communications AB > > * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. > > */ > > +#include > > #include > > #include > > #include > > @@ -15,6 +16,8 @@ > > #include > > #include "qcom_q6v5.h" > > > > +#define Q6V5_PANIC_DELAY_MS 200 > > + > > /** > > * qcom_q6v5_prepare() - reinitialize the qcom_q6v5 context before start > > * @q6v5: reference to qcom_q6v5 context to be reinitialized > > @@ -162,6 +165,22 @@ int qcom_q6v5_request_stop(struct qcom_q6v5 *q6v5) > > } > > EXPORT_SYMBOL_GPL(qcom_q6v5_request_stop); > > > > +/** > > + * qcom_q6v5_panic() - panic handler to invoke a stop on the remote > > + * @q6v5: reference to qcom_q6v5 context > > + * > > + * Set the stop bit and sleep in order to allow the remote processor to flush > > + * its caches etc for post mortem debugging. > > + */ > > +void qcom_q6v5_panic(struct qcom_q6v5 *q6v5) > > +{ > > + qcom_smem_state_update_bits(q6v5->state, > > + BIT(q6v5->stop_bit), BIT(q6v5->stop_bit)); > > + > > + mdelay(Q6V5_PANIC_DELAY_MS); > > I really wonder if the delay should be part of the remoteproc core and > configurable via device tree. Wanting the remote processor to flush its caches > is likely something other vendors will want when dealing with a kernel panic. > It would be nice to see if other people have an opinion on this topic. If not > then we can keep the delay here and move it to the core if need be. > I gave this some more thought and what we're trying to achieve is to signal the remote processors about the panic and then give them time to react, but per the proposal (and Qualcomm downstream iirc) we will do this for each remote processor, one by one. So in the typical case of a Qualcomm platform with 4-5 remoteprocs we'll end up giving the first one a whole second to react and the last one "only" 200ms. Moving the delay to the core by iterating over rproc_list calling panic() and then delaying would be cleaner imo. It might be nice to make this configurable in DT, but I agree that it would be nice to hear from others if this would be useful. Regards, Bjorn > Thanks, > Mathieu > > > +} > > +EXPORT_SYMBOL_GPL(qcom_q6v5_panic); > > + > > /** > > * qcom_q6v5_init() - initializer of the q6v5 common struct > > * @q6v5: handle to be initialized > > diff --git a/drivers/remoteproc/qcom_q6v5.h b/drivers/remoteproc/qcom_q6v5.h > > index 7ac92c1e0f49..c37e6fd063e4 100644 > > --- a/drivers/remoteproc/qcom_q6v5.h > > +++ b/drivers/remoteproc/qcom_q6v5.h > > @@ -42,5 +42,6 @@ int qcom_q6v5_prepare(struct qcom_q6v5 *q6v5); > > int qcom_q6v5_unprepare(struct qcom_q6v5 *q6v5); > > int qcom_q6v5_request_stop(struct qcom_q6v5 *q6v5); > > int qcom_q6v5_wait_for_start(struct qcom_q6v5 *q6v5, int timeout); > > +void qcom_q6v5_panic(struct qcom_q6v5 *q6v5); > > > > #endif > > -- > > 2.24.0 > >