linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeffrey Hugo <jhugo@codeaurora.org>
To: Loic Poulain <loic.poulain@linaro.org>
Cc: Bhaumik Bhatt <bbhatt@codeaurora.org>,
	ath11k@lists.infradead.org, cjhuang@codeaurora.org,
	clew@codeaurora.org, hemantk@codeaurora.org,
	kvalo@codeaurora.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org,
	manivannan.sadhasivam@linaro.org, netdev@vger.kernel.org
Subject: Re: [PATCH] net: qrtr: Unprepare MHI channels during remove
Date: Wed, 18 Nov 2020 12:34:27 -0700	[thread overview]
Message-ID: <2019fe3c-55c5-61fe-758c-1e9952e1cb33@codeaurora.org> (raw)
In-Reply-To: <CAMZdPi_b0=qFNGi1yUke3Dip2bi-zW4ULTg8W4nbyPyEsE3D4w@mail.gmail.com>

On 11/18/2020 12:14 PM, Loic Poulain wrote:
> 
> 
> Le mer. 18 nov. 2020 à 19:34, Jeffrey Hugo <jhugo@codeaurora.org 
> <mailto:jhugo@codeaurora.org>> a écrit :
> 
>     On 11/18/2020 11:20 AM, Bhaumik Bhatt wrote:
>      > Reset MHI device channels when driver remove is called due to
>      > module unload or any crash scenario. This will make sure that
>      > MHI channels no longer remain enabled for transfers since the
>      > MHI stack does not take care of this anymore after the auto-start
>      > channels feature was removed.
>      >
>      > Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org
>     <mailto:bbhatt@codeaurora.org>>
>      > ---
>      >   net/qrtr/mhi.c | 1 +
>      >   1 file changed, 1 insertion(+)
>      >
>      > diff --git a/net/qrtr/mhi.c b/net/qrtr/mhi.c
>      > index 7100f0b..2bf2b19 100644
>      > --- a/net/qrtr/mhi.c
>      > +++ b/net/qrtr/mhi.c
>      > @@ -104,6 +104,7 @@ static void qcom_mhi_qrtr_remove(struct
>     mhi_device *mhi_dev)
>      >       struct qrtr_mhi_dev *qdev = dev_get_drvdata(&mhi_dev->dev);
>      >
>      >       qrtr_endpoint_unregister(&qdev->ep);
>      > +     mhi_unprepare_from_transfer(mhi_dev);
>      >       dev_set_drvdata(&mhi_dev->dev, NULL);
>      >   }
>      >
>      >
> 
>     I admit, I didn't pay much attention to the auto-start being removed,
>     but this seems odd to me.
> 
>     As a client, the MHI device is being removed, likely because of some
>     factor outside of my control, but I still need to clean it up?  This
>     really feels like something MHI should be handling.
> 
> 
> I think this is just about balancing operations, what is done in probe 
> should be undone in remove, so here channels are started in probe and 
> stopped/reset in remove.

I understand that perspective, but that doesn't quite match what is 
going on here.  Regardless of if the channel was started (prepared) in 
probe, it now needs to be stopped in remove.  That not balanced in all cases

Lets assume, in response to probe(), my client driver goes and creates 
some other object, maybe a socket.  In response to that socket being 
opened/activated by the client of my driver, I go and start the mhi 
channel.  Now, normally, when the socket is closed/deactivated, I stop 
the MHI channel.  In this case, stopping the MHI channel in remove() is 
unbalanced with respect to probe(), but is now a requirement.

Now you may argue, I should close the object in response to remove, 
which will then trigger the stop on the channel.  That doesn't apply to 
everything.  For example, you cannot close an open file in the kernel. 
You need to wait for userspace to close it.  By the time that happens, 
the mhi_dev is long gone I expect.

So if, somehow, the client driver is the one causing the remove to 
occur, then yes it should probably be the one doing the stop, but that's 
a narrow set of conditions, and I think having that requirement for all 
scenarios is limiting.


-- 
Jeffrey Hugo
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

  parent reply	other threads:[~2020-11-18 19:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-18 18:20 [PATCH] net: qrtr: Unprepare MHI channels during remove Bhaumik Bhatt
2020-11-18 18:34 ` Jeffrey Hugo
2020-11-18 19:13   ` Bhaumik Bhatt
     [not found]   ` <CAMZdPi_b0=qFNGi1yUke3Dip2bi-zW4ULTg8W4nbyPyEsE3D4w@mail.gmail.com>
2020-11-18 19:34     ` Jeffrey Hugo [this message]
2020-11-19 19:02       ` Bhaumik Bhatt
2020-11-25 18:01         ` Jeffrey Hugo
2020-11-20  5:10 ` Jakub Kicinski
2020-11-20  6:15   ` Manivannan Sadhasivam
2020-11-20  6:18     ` Jakub Kicinski
2020-11-20  6:23       ` Manivannan Sadhasivam

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=2019fe3c-55c5-61fe-758c-1e9952e1cb33@codeaurora.org \
    --to=jhugo@codeaurora.org \
    --cc=ath11k@lists.infradead.org \
    --cc=bbhatt@codeaurora.org \
    --cc=cjhuang@codeaurora.org \
    --cc=clew@codeaurora.org \
    --cc=hemantk@codeaurora.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=loic.poulain@linaro.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=netdev@vger.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).