All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Chris Down <chris@chrisdown.name>
Cc: linux-kernel@vger.kernel.org, Petr Mladek <pmladek@suse.com>,
	kernel-team@fb.com
Subject: Re: [RFC PATCH] printk: console: Allow each console to have its own loglevel
Date: Thu, 19 May 2022 09:04:34 +0200	[thread overview]
Message-ID: <YoXsAkUgzIjJR90W@kroah.com> (raw)
In-Reply-To: <YoVWpZKHD7aec0CJ@chrisdown.name>

On Wed, May 18, 2022 at 09:27:17PM +0100, Chris Down wrote:
> Greg Kroah-Hartman writes:
> > > If you're talking about properly freeing the memory, I suppose it should
> > > happen by doing something like the following in unregister_console():
> > > 
> > >     if (!console_drivers)
> > >         /* free the class object under console lock */
> > > 
> > > ...right? Let me know if I'm misunderstanding you.
> > 
> > You can't do that as the driver core should now be managing the
> > lifespace of that object.  You can't "know" when the object's memory is
> > to be freed EXCEPT in the release function.
> > 
> > So free it there please.
> > 
> > Or do not tie the lifepan of the console class device object to the
> > console object, and keep it separate.  I don't remember exactly how you
> > tied them together here, sorry.
> 
> [...]
> 
> > > > Do you ever free the class?
> > > 
> > > Currently no. What do you think about the above proposal to do it once the
> > > console driver list is exhausted?
> > 
> > If the code can never be unloaded, no, don't worry about it.
> 
> So just so I understand, there's no problem here if we're not going to free
> the class object, correct? These two stanzas in your reply refer to the same
> thing, right?

The two stanzas in my reply do NOT refer to the same thing.

The first one is for the device that is assigned to the class.  That
must be freed and properly reference counted and handled as that is a
dynamic object that can come and go as people add and remove consoles.

The second is the 'struct class' itself.  You can register that and be
done with it if your code can never be unloaded as it can not be a
module.

Hope that explains the confusion better.

thanks,

greg k-h

  reply	other threads:[~2022-05-19  7:04 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-18 14:24 [RFC PATCH] printk: console: Allow each console to have its own loglevel Chris Down
2022-05-18 14:32 ` Chris Down
2022-05-18 15:34 ` Greg Kroah-Hartman
2022-05-18 19:46   ` Chris Down
2022-05-18 19:54     ` Greg Kroah-Hartman
2022-05-18 20:27       ` Chris Down
2022-05-19  7:04         ` Greg Kroah-Hartman [this message]
2022-05-19 14:12           ` Chris Down
2022-05-19 14:35             ` Greg Kroah-Hartman
2022-05-19 15:08               ` Chris Down
2022-05-19 15:24                 ` Greg Kroah-Hartman
2022-05-19 15:25                 ` Greg Kroah-Hartman
2022-05-19 15:55                   ` Chris Down
2022-05-19 17:45                     ` Greg Kroah-Hartman
2022-05-19 17:55                       ` Chris Down
2022-05-24  9:19     ` Petr Mladek
2022-05-30 10:48       ` [OFFLIST] " Chris Down
2022-05-30 10:49         ` Chris Down
2022-05-19  4:48 ` kernel test robot
2022-05-19  7:26 ` Geert Uytterhoeven
2022-05-19 14:37   ` Chris Down
2022-05-19 17:48     ` Geert Uytterhoeven
2022-05-19 18:05       ` Chris Down
2022-05-19 13:59 ` [printk] 6f922c8d53: BUG:kernel_NULL_pointer_dereference,address kernel test robot
2022-05-19 13:59   ` [printk] 6f922c8d53: BUG:kernel_NULL_pointer_dereference, address kernel test robot

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=YoXsAkUgzIjJR90W@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=chris@chrisdown.name \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmladek@suse.com \
    /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.