From: Phillip Potter <phil@philpotter.co.uk>
To: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
Cc: Larry Finger <Larry.Finger@lwfinger.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Dan Carpenter <dan.carpenter@oracle.com>,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/3] staging: r8188eu: use completions and clean rtw_cmd_thread()
Date: Sun, 17 Oct 2021 10:48:02 +0100 [thread overview]
Message-ID: <YWvxUg0/5TrVZu8M@equinox> (raw)
In-Reply-To: <3115690.HXPuu0oz9h@localhost.localdomain>
On Sat, Oct 16, 2021 at 07:54:51PM +0200, Fabio M. De Francesco wrote:
> I guess that Dan will disagree with us :) Did you read his last message?
>
> I hope that he has time to review these patches. He expressed some doubts
> about splitting the changes in two separate patches. As far as I know, since
> Dan is a very experienced engineer (I am not even graduated and everything I
> know of Computer Science is self-taught), I could have been wrong in doing
> this work the way I did.
>
I did read it yes, he makes good points, and my motivation is simply
that the patches look fine as they are to me personally :-)
> > given that one semaphore was there for kthread start/stop and the other
> > for queuing. Looks good to me anyway based on what I know of completion
> > variables :-) I assume you've not made the waits killable or
> > interruptible in patch 1 due to the fact they are specifically related
> > to kthread start/stop?
>
> Good question! :)
>
> Let me explain how I chose to make one wait killable and the other
> uninterruptible.
>
> As far as I know, waiters may spin or sleep while waiting to acquire a lock
> (see spinlocks or mutexes for instance) or to be awakened (completions and
> condition variables for instance).
>
> These were the cases of sleeping waiters. Sleeping can be done in
> uninterruptible, interruptible / killable, and timed-out states.
>
> Where I'm 100% sure that the code doesn't require / want to be interrupted
> for whatever reason I prefer to use uninterruptible variants (and so I did in
> 1/3).
>
> When I'm not sure of the requirement above, I prefer to avoid that the
> process or the entire system hangs while waiting to acquire a mutex or to be
> awakened by a complete() (and so on).
>
> Conversely, using interruptible versions without proper checking of return
> codes and without proper managing of errors may lead to serious bugs.
>
> Kernel threads (kthreads) are like user processes / threads and are scheduled
> the same way the former are. One noteworthy difference is that their mm
> pointer is NULL (they have not an userspace address spaces). However they are
> still threads that have a PID in userspace and they can be killed by root.
>
> This is the output of the "ps -ef" command after "modprobe r8188eu":
>
> localhost:~ # ps -ef | grep RTW
> root 1726 2 0 19:06 ? 00:00:00 [RTW_CMD_THREAD]
>
> Since the developers who wrote the original code thought that that thread
> must be interrupted I thought that restricting interruptions to kills was the
> wiser choice in 2/3. Conversely, I cannot see reasons to interrupt the core
> part of a driver, so I chose to use an uninterruptible version of
> wait_for_completion*() in the other parts of the code.
>
> I warned you that I'm not an engineer, so please double check my argument :)
>
Sounds good to me, just wanted to know your reasoning.
> > Anyhow:
> >
> > For whole series:
> > Acked-by: Phillip Potter <phil@philpotter.co.uk>
>
> Thanks for you ack. I really appreciated it.
>
You're welcome :-)
Regards,
Phil
prev parent reply other threads:[~2021-10-17 9:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-16 9:10 [PATCH 0/3] staging: r8188eu: use completions and clean rtw_cmd_thread() Fabio M. De Francesco
2021-10-16 9:10 ` [PATCH 1/3] staging: r8188eu: Use completions for signaling start and end kthread Fabio M. De Francesco
2021-10-16 19:26 ` Dan Carpenter
2021-10-16 19:32 ` Fabio M. De Francesco
2021-10-16 9:10 ` [PATCH 2/3] staging: r8188eu: Use completions for signaling enqueueing Fabio M. De Francesco
2021-10-16 9:10 ` [PATCH 3/3] staging: r8188eu: Remove redundant 'if' statement Fabio M. De Francesco
2021-10-16 9:59 ` Martin Kaiser
2021-10-16 15:27 ` [PATCH 0/3] staging: r8188eu: use completions and clean rtw_cmd_thread() Phillip Potter
2021-10-16 17:54 ` Fabio M. De Francesco
2021-10-17 9:48 ` Phillip Potter [this message]
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=YWvxUg0/5TrVZu8M@equinox \
--to=phil@philpotter.co.uk \
--cc=Larry.Finger@lwfinger.net \
--cc=dan.carpenter@oracle.com \
--cc=fmdefrancesco@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
/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