linux-hardening.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mukesh Ojha <quic_mojha@quicinc.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	<agross@kernel.org>, <andersson@kernel.org>,
	<konrad.dybcio@linaro.org>, <corbet@lwn.net>,
	<keescook@chromium.org>, <tony.luck@intel.com>,
	<gpiccoli@igalia.com>, <catalin.marinas@arm.com>,
	<will@kernel.org>, <krzysztof.kozlowski+dt@linaro.org>,
	<robh+dt@kernel.org>, <linus.walleij@linaro.org>,
	<linux-gpio@vger.kernel.org>, <srinivas.kandagatla@linaro.org>
Cc: <linux-arm-msm@vger.kernel.org>,
	<linux-remoteproc@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux-hardening@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-doc@vger.kernel.org>
Subject: Re: [PATCH v3 04/18] soc: qcom: Add Qualcomm minidump kernel driver
Date: Mon, 8 May 2023 12:40:45 +0530	[thread overview]
Message-ID: <e714566e-39b7-d46b-13bd-3c0e20e9f944@quicinc.com> (raw)
In-Reply-To: <500e5abc-fb71-8468-a6b0-3ced2676b57c@linaro.org>



On 5/4/2023 10:04 PM, Krzysztof Kozlowski wrote:
> On 04/05/2023 17:21, Krzysztof Kozlowski wrote:
>>>>
>>>>> +	ret = qcom_minidump_init_apss_subsystem(md);
>>>>> +	if (ret) {
>>>>> +		dev_err(&pdev->dev, "apss minidump initialization failed: %d\n", ret);
>>>>> +		goto unlock;
>>>>> +	}
>>>>> +
>>>>> +	__md = md;
>>>>
>>>> No. This is a platform device, so it can have multiple instances.
>>>
>>> It can have only one instance that is created from SMEM driver probe.
>>
>> Anyone can instantiate more of them.... how did you solve it?
> 
> To clarify - sprinkling more of singletons makes everything tightly
> coupled, difficult to debug and non-portable. You cannot have two
> instances, you have to control concurrent initialization by yourself in
> each of such singletons.
> 
> I understand sometimes they are unavoidable, for example when this does
> not map to hardware property. However here you have the parent - smem -
> which can return you valid instance. Thus you avoid entire problem of
> file-scope variables.

I get your point, why one's should avoid file scope variables.


This is infrastructure driver and will not have multiple instances and 
even if it happens could be avoided with with the help of global mutex 
and protect below function which i am already doing at the moment and 
fail the other probe if it is already initialized with proper logging..e.g

"already initialized..."


ret = qcom_minidump_init_apss_subsystem(md);


And this will be in-lined with

/* Pointer to the one and only smem handle */
static struct qcom_smem *__smem;

Let me know if you still disagree...and have some other way ?


-- Mukesh


> 
> Best regards,
> Krzysztof
> 

  reply	other threads:[~2023-05-08  7:12 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-03 17:02 [PATCH v3 00/18] Add basic Minidump kernel driver support Mukesh Ojha
2023-05-03 17:02 ` [PATCH v3 01/18] remoteproc: qcom: Expand MD_* as MINIDUMP_* Mukesh Ojha
2023-05-04 12:35   ` Krzysztof Kozlowski
2023-05-03 17:02 ` [PATCH v3 02/18] remoteproc: qcom: Move minidump specific data to qcom_minidump.h Mukesh Ojha
2023-05-04 11:38   ` Krzysztof Kozlowski
2023-05-04 11:58     ` Mukesh Ojha
2023-05-04 12:03       ` Krzysztof Kozlowski
2023-05-04 12:26         ` Mukesh Ojha
2023-05-04 12:36           ` Krzysztof Kozlowski
2023-05-04 12:57             ` Mukesh Ojha
2023-05-04 15:16               ` Krzysztof Kozlowski
2023-05-03 17:02 ` [PATCH v3 03/18] docs: qcom: Add qualcomm minidump guide Mukesh Ojha
2023-05-08 10:01   ` Bagas Sanjaya
2023-05-25 16:00     ` Mukesh Ojha
2023-05-13 18:46   ` Randy Dunlap
2023-05-25 15:59     ` Mukesh Ojha
2023-05-03 17:02 ` [PATCH v3 04/18] soc: qcom: Add Qualcomm minidump kernel driver Mukesh Ojha
2023-05-04 11:36   ` Krzysztof Kozlowski
2023-05-04 12:38     ` Mukesh Ojha
2023-05-04 15:21       ` Krzysztof Kozlowski
2023-05-04 16:34         ` Krzysztof Kozlowski
2023-05-08  7:10           ` Mukesh Ojha [this message]
2023-05-09  7:11             ` Krzysztof Kozlowski
2023-05-28 11:29               ` Mukesh Ojha
2023-05-14  4:16             ` Trilok Soni
2023-05-05  5:34         ` Mukesh Ojha
2023-06-02 10:43     ` Mukesh Ojha
2023-05-03 17:02 ` [PATCH v3 05/18] soc: qcom: minidump: Add pending region registration support Mukesh Ojha
2023-05-03 17:02 ` [PATCH v3 06/18] soc: qcom: minidump: Add update region support Mukesh Ojha
2023-05-04 11:40   ` Krzysztof Kozlowski
2023-05-03 17:02 ` [PATCH v3 07/18] arm64: defconfig: Enable Qualcomm minidump driver Mukesh Ojha
2023-05-04 11:23   ` Krzysztof Kozlowski
2023-05-04 11:45     ` Mukesh Ojha
2023-05-04 12:32       ` Krzysztof Kozlowski
2023-05-04 14:43         ` Mukesh Ojha
2023-05-04 15:24           ` Krzysztof Kozlowski
2023-05-03 17:02 ` [PATCH v3 08/18] remoterproc: qcom: refactor to leverage exported minidump symbol Mukesh Ojha
2023-05-03 17:02 ` [PATCH v3 09/18] soc: qcom: Add qcom's pstore minidump driver support Mukesh Ojha
2023-05-04 15:35   ` Krzysztof Kozlowski
2023-05-09 16:06   ` Luca Stefani
2023-05-16 20:48     ` Kees Cook
2023-05-03 17:02 ` [PATCH v3 10/18] dt-bindings: reserved-memory: Add qcom,ramoops-minidump binding Mukesh Ojha
2023-05-04 11:22   ` Krzysztof Kozlowski
2023-05-03 17:02 ` [PATCH v3 11/18] arm64: dts: qcom: sm8450: Add Qualcomm ramoops minidump node Mukesh Ojha
2023-05-04  7:14   ` Konrad Dybcio
2023-05-04 11:26   ` Krzysztof Kozlowski
2023-05-03 17:02 ` [PATCH v3 12/18] soc: qcom: Register pstore frontend region with minidump Mukesh Ojha
2023-05-09 15:45   ` Luca Stefani
2023-05-16 20:50   ` Kees Cook
2023-05-03 17:02 ` [PATCH v3 13/18] arm64: defconfig: Enable Qualcomm pstore minidump client driver Mukesh Ojha
2023-05-04 11:23   ` Krzysztof Kozlowski
2023-05-03 17:02 ` [PATCH v3 14/18] firmware: qcom_scm: provide a read-modify-write function Mukesh Ojha
2023-05-18 18:48   ` Trilok Soni
2023-05-03 17:02 ` [PATCH v3 15/18] pinctrl: qcom: Use qcom_scm_io_update_field() Mukesh Ojha
2023-05-03 17:02 ` [PATCH v3 16/18] firmware: scm: Modify only the download bits in TCSR register Mukesh Ojha
2023-05-03 17:02 ` [PATCH v3 17/18] firmware: qcom_scm: Refactor code to support multiple download mode Mukesh Ojha
2023-05-03 17:02 ` [PATCH v3 18/18] firmware: qcom_scm: Add multiple download mode support Mukesh Ojha
2023-05-04 11:26 ` [PATCH v3 00/18] Add basic Minidump kernel driver support Krzysztof Kozlowski
2023-07-15 22:13 ` (subset) " Bjorn Andersson
2023-07-17  1:15   ` Mathieu Poirier
2023-07-17  8:02     ` Krzysztof Kozlowski
2023-07-17 16:21     ` Bjorn Andersson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e714566e-39b7-d46b-13bd-3c0e20e9f944@quicinc.com \
    --to=quic_mojha@quicinc.com \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=corbet@lwn.net \
    --cc=gpiccoli@igalia.com \
    --cc=keescook@chromium.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=tony.luck@intel.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).