All of lore.kernel.org
 help / color / mirror / Atom feed
From: Drew Abbott <abbotta4@gmail.com>
To: Greg KH <greg@kroah.com>
Cc: kernelnewbies@kernelnewbies.org
Subject: Re: Kernel module that shuts down the device
Date: Mon, 8 Nov 2021 14:53:37 -0600	[thread overview]
Message-ID: <CALY-g84_two85_kcLOfwdFktSJB5_8c8=aJjbVqtvnLNm7+-yg@mail.gmail.com> (raw)
In-Reply-To: <YYi/twivgx6PvJ9+@kroah.com>


[-- Attachment #1.1: Type: text/plain, Size: 1451 bytes --]

> There's a whole bunch of ways to schedule work in the kernel, it doesn't
have to be
> a heartbeat function.
>
> Plenty of drivers are split into IRQ and non-IRQ parts (sometimes called
the top and
> bottom parts of the driver).  See how they get info from the IRQ part to
the non-IRQ part.

I saw that this driver and others use workqueues to run longer functions
outside of the irq handlers in the process context, so I tried scheduling a
simple work struct that calls kernel_power_off() with this new patch:
https://github.com/Abbotta4/linux/commit/008a720d9ffc31d5b60e0ca36f2aad0a04d50f0a
after reading up on workqueues a bit here:
https://linux-kernel-labs.github.io/refs/heads/master/labs/deferred_work.html#workqueues
but the device still seems to hang at the blocking_notifier_call_chain()
call. Is there something else I am missing here, other than leaving the irq
context?

> But step back, why would this driver ever want to shut down the machine
> at all?  What problem are you trying to solve by making changes in this
> driver?

This change is to help the factory team test the devices before they are
fully assembled. There are a series of tests that they run on different
components and being able to unplug the device to trigger a shutdown is one
of their priorities. I hope that sheds some light on the context of these
patches and the strange functionality I am trying to implement. Sorry if it
caused any confusion.

Thanks,
Drew

[-- Attachment #1.2: Type: text/html, Size: 1945 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

  reply	other threads:[~2021-11-08 20:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-07  0:54 Kernel module that shuts down the device Drew Abbott
2021-11-07  8:31 ` Greg KH
2021-11-08  0:16   ` Drew Abbott
2021-11-08  0:38     ` Valdis Klētnieks
2021-11-08  6:12     ` Greg KH
2021-11-08 20:53       ` Drew Abbott [this message]
2021-11-09  6:23         ` Greg KH

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='CALY-g84_two85_kcLOfwdFktSJB5_8c8=aJjbVqtvnLNm7+-yg@mail.gmail.com' \
    --to=abbotta4@gmail.com \
    --cc=greg@kroah.com \
    --cc=kernelnewbies@kernelnewbies.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.