Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1105680ybh; Mon, 13 Jul 2020 09:27:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4SHiyujH+wVx9la2ux9Bxw0utG1NYEaq37z789m7RNiFoGS3AWHvO8Icx3P/laBWTbWX+ X-Received: by 2002:aa7:d58c:: with SMTP id r12mr250265edq.160.1594657651617; Mon, 13 Jul 2020 09:27:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594657651; cv=none; d=google.com; s=arc-20160816; b=aacbhUsEbAaAOtsk0O2MC9/LEQJe3WDaDGG7WirDzqv8Kb1ryWn2ZeTUfhiw9AWg8Z dtkB2x4Eo/T71R5lAkz+8j54mrFxVsM5wlB1DalXf2FJs55e4BcX+PMY4i9XYj+9Gii5 PRoJIftChRdMpEr4dMGFpcGBn169P5NdbkgC5LixmypQF5/wH4mnjsSIMzf6w0hA2x0g yw+f6m40OH2QmwUXjz+RvmGDCeYbQ+Y5enCoCpzQuuo1JG3n5JJDpp4RyEZpSK5+ABp8 qUtCIbYgtwYkYyN1hNqNY5H32jW9m81GdPrMaI9HD1PNWIh4dUY2mbulS0Sbt0yfS9Hx nxSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=n+W/fHPjiMLdifX49gddUCYGAELEgIBFfQAWGVbyyE8=; b=nW0gs5MCk7OAnJP6/izEUJ3xKv/VQwsNsvT3wVv8LfVHSJhteXcbtR+6LopAg4Dm3f StwbuUcx89gbGYZ41uif9k1uPUUZrYQ4XwwUkOGG3ILd/C8UnTns3gem7sfj2E+fcFJH rzWOO75Vo1zF1nkRSNDFDF9kxeFSJSlYXwowc4cj26kKvfK3FOhu8ST8j1WyJPHrrpnz FN+DsvTPPE6Mj9hTgPEDCugigCGoXwMMnOTXEQr0e7A4gREy4RLvxN7k+lNN8Ce8p1iS kbziA54s+cnXF/gP1VPYA3QSWqxWGT4wFYpihCDqQnOBwQSkZBgBzHrTLUCErPfiS+MY qzcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=WvP9QjqA; 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=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dr2si11972367ejc.18.2020.07.13.09.27.07; Mon, 13 Jul 2020 09:27:31 -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=@nvidia.com header.s=n1 header.b=WvP9QjqA; 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=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730000AbgGMQ0r (ORCPT + 99 others); Mon, 13 Jul 2020 12:26:47 -0400 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]:12629 "EHLO hqnvemgate25.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729593AbgGMQ0r (ORCPT ); Mon, 13 Jul 2020 12:26:47 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 13 Jul 2020 09:25:49 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 13 Jul 2020 09:26:46 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 13 Jul 2020 09:26:46 -0700 Received: from [10.26.72.101] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 13 Jul 2020 16:26:44 +0000 Subject: Re: [PATCH v6 1/2] remoteproc: qcom: Add per subsystem SSR notification To: Rishabh Bhatnagar , , CC: , , , , , linux-tegra References: <1592965408-16908-1-git-send-email-rishabhb@codeaurora.org> <1592965408-16908-2-git-send-email-rishabhb@codeaurora.org> From: Jon Hunter Message-ID: <98e3a18e-1491-6f20-6507-d6e6817b76fe@nvidia.com> Date: Mon, 13 Jul 2020 17:26:42 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <1592965408-16908-2-git-send-email-rishabhb@codeaurora.org> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1594657549; bh=n+W/fHPjiMLdifX49gddUCYGAELEgIBFfQAWGVbyyE8=; h=X-PGP-Universal:Subject:To:CC:References:From:Message-ID:Date: User-Agent:MIME-Version:In-Reply-To:X-Originating-IP: X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=WvP9QjqA1apj6IdMTqNWwQW8Mv+jSmgZuhsua2WWsJluO8QGxsdYFR0P3cbkPk2ZJ Db9PDdGwAGhKyCtYnv0kEdeUbHIk2stgK52SzcgJoUEkjIvINh7mQM/FHi8Y981w0m TAP+RtpFSWn9HGhhFrirKiVErYUsHI9O3JFcMgDUApXKfnt1dtJM9dH8f7rm4FJfb1 u4yM9+QmvpI7O9VZB550oy2yBrPYpFb2YziyZcLCELiYxznS9ZZwLCbWWDCm9uF6Jv Wjr1x+JZUx8U/6wRy5Xv6TQo7vUcZ7x+WWVhcx4JYfp/qsPFW9g3vlqg1HW7MY4arz iVBSiB9DTLXtA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24/06/2020 03:23, Rishabh Bhatnagar wrote: > Currently there is a single notification chain which is called whenever any > remoteproc shuts down. This leads to all the listeners being notified, and > is not an optimal design as kernel drivers might only be interested in > listening to notifications from a particular remoteproc. Create a global > list of remoteproc notification info data structures. This will hold the > name and notifier_list information for a particular remoteproc. The API > to register for notifications will use name argument to retrieve the > notification info data structure and the notifier block will be added to > that data structure's notification chain. Also move from blocking notifier > to srcu notifer based implementation to support dynamic notifier head > creation. > > Signed-off-by: Siddharth Gupta > Signed-off-by: Rishabh Bhatnagar > --- > drivers/remoteproc/qcom_common.c | 90 ++++++++++++++++++++++++++++++----- > drivers/remoteproc/qcom_common.h | 5 +- > include/linux/remoteproc/qcom_rproc.h | 20 ++++++-- > 3 files changed, 95 insertions(+), 20 deletions(-) > > diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c > index 9028cea..7a7384c 100644 > --- a/drivers/remoteproc/qcom_common.c > +++ b/drivers/remoteproc/qcom_common.c > @@ -12,6 +12,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -23,7 +24,14 @@ > #define to_smd_subdev(d) container_of(d, struct qcom_rproc_subdev, subdev) > #define to_ssr_subdev(d) container_of(d, struct qcom_rproc_ssr, subdev) > > -static BLOCKING_NOTIFIER_HEAD(ssr_notifiers); > +struct qcom_ssr_subsystem { > + const char *name; > + struct srcu_notifier_head notifier_list; > + struct list_head list; > +}; > + > +static LIST_HEAD(qcom_ssr_subsystem_list); > +static DEFINE_MUTEX(qcom_ssr_subsys_lock); > > static int glink_subdev_start(struct rproc_subdev *subdev) > { > @@ -189,37 +197,83 @@ void qcom_remove_smd_subdev(struct rproc *rproc, struct qcom_rproc_subdev *smd) > } > EXPORT_SYMBOL_GPL(qcom_remove_smd_subdev); > > +static struct qcom_ssr_subsystem *qcom_ssr_get_subsys(const char *name) > +{ > + struct qcom_ssr_subsystem *info; > + > + mutex_lock(&qcom_ssr_subsys_lock); > + /* Match in the global qcom_ssr_subsystem_list with name */ > + list_for_each_entry(info, &qcom_ssr_subsystem_list, list) > + if (!strcmp(info->name, name)) > + goto out; > + > + info = kzalloc(sizeof(*info), GFP_KERNEL); > + if (!info) { > + info = ERR_PTR(-ENOMEM); > + goto out; > + } The above appears to be breaking the ARM64 build on the latest -next when building the modules ... CC [M] drivers/remoteproc/qcom_common.o drivers/remoteproc/qcom_common.c: In function 'qcom_ssr_get_subsys': remoteproc/qcom_common.c:210:9: error: implicit declaration of function 'kzalloc' [-Werror=implicit-function-declaration] info = kzalloc(sizeof(*info), GFP_KERNEL); ^~~~~~~ drivers/remoteproc/qcom_common.c:210:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion] info = kzalloc(sizeof(*info), GFP_KERNEL); Cheers Jon -- nvpublic