Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp231075ioo; Fri, 20 May 2022 19:58:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrv9HNM1WDPNtK6MwVa49vlMRCXD7+T7FjTBs1e7FkTfRWwx20fQ/bYfIDBOkSJem9dLVQ X-Received: by 2002:aa7:d88f:0:b0:42a:adb3:be01 with SMTP id u15-20020aa7d88f000000b0042aadb3be01mr14219122edq.219.1653101912317; Fri, 20 May 2022 19:58:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653101912; cv=none; d=google.com; s=arc-20160816; b=pZUNg2eISFZpzu+Rf7P1aN8SWipNl/YgospMmn4jF/jcwcX/ql+lQv92ldv5SdvCGB e9Ox9FwcSBOmFEHHJxmQzZLI9/crApQmjST0hPZMQt3vMFiDaNXU6Qv/grqMeBIUH7lm 1pr4ECEvJl6B7bSAwcVZ6hVVMkknrnZpA5g11HIahCRV5otReAzDC4BPga31JaVUFqYS ki6hP45DeoOjp3bKqLiZtZeQMM8ZoPmWpjO9/sbtzjyCsvWZcw+rGd8eljtzbxqLD250 fsitFkJ9QNXQK0dH3QBzu9BSxOBbp4JrHDGDL45v/vcJfO938HWoo/u7e3K1ZSe1kZr4 qC+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=s9ZZBRE8mi3WBlmecPBUnmTcgc4Ctnk2SShAkbgliH8=; b=fxw49tLnnj27PzQ5gZcUkTPcXdzvn5llYjckXTDZkwBxFhzwgvles/WW88feTd1RPC RFBG7foavb0WGSv2yJqZ/XDpfhRv9h0J9DznLuKBHcKMJdGKqJ2cw+p5WzGBpsUIf50X 5wH/9T2bHc8rR7n53NtXu6t9YpWF4yKBX4fcklELvl1eMF+QyIudRmrfhrKuCjvhGv0R 5IhE5MqguHLXXKwnAP1Pxh7i2C1+EcaNqQzp6WIJVCjSwNmjfv5ASzZiPfHx/u5zwRZX i9+6LZLGpx3LSaB8S4gq614S5GQH6uuXtJhzmZ4akDQ3OhN5Bm8TENB90LLkgOkPCcFo jZIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YROcSI+s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du20-20020a17090772d400b006feb8cc7e1fsi1580269ejc.1000.2022.05.20.19.58.05; Fri, 20 May 2022 19:58:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YROcSI+s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239841AbiESOfu (ORCPT + 99 others); Thu, 19 May 2022 10:35:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235741AbiESOfs (ORCPT ); Thu, 19 May 2022 10:35:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86DCFC72 for ; Thu, 19 May 2022 07:35:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1D6AE61968 for ; Thu, 19 May 2022 14:35:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EA85C385AA; Thu, 19 May 2022 14:35:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652970942; bh=txyDqxHnLr967LUH/PkRPHTEXJ47uC5wTvkjxVnQSyA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YROcSI+sNZ2lD7VyG3SQxcEtlM+urfO3Sy+Oyo5MddwkAXLd6jGkUjIqXmxrlP4+4 nQWN67j022CFu/7Qy/FBZJZTeXejld55xxQKFZqluWjejVbPERCx4nuDqll+0tlXfF juHei5Re65xWsw4dgVEB/8yV5Bbh4ZEmvajmhKTY= Date: Thu, 19 May 2022 16:35:40 +0200 From: Greg Kroah-Hartman To: Chris Down Cc: linux-kernel@vger.kernel.org, Petr Mladek , kernel-team@fb.com Subject: Re: [RFC PATCH] printk: console: Allow each console to have its own loglevel Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 19, 2022 at 03:12:19PM +0100, Chris Down wrote: > Greg Kroah-Hartman writes: > > 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. > > Ah, I see. So to be clear, this change would fix what you're concerned > about, right? :-) > > If so I'll do this in v2. Thanks! > > --- > > diff --git include/linux/console.h include/linux/console.h > index ce5ba405285a..408dd86be8eb 100644 > --- include/linux/console.h > +++ include/linux/console.h > @@ -156,12 +156,6 @@ static inline int con_debug_leave(void) > */ > #define CON_LOGLEVEL (128) /* Level set locally for this console */ > -/* > - * Console has active class device, so may have active readers/writers from > - * /sys/class hierarchy. > - */ > -#define CON_CLASSDEV_ACTIVE (256) > - > struct console { > char name[16]; > void (*write)(struct console *, const char *, unsigned); > @@ -179,9 +173,11 @@ struct console { > void *data; > struct console *next; > int level; > - struct device classdev; > + struct device *classdev; Ick, no, keep the real structure here. It can properly handle the reference counting for the object. Just correctly clean up in the release function, not anywhere else. thanks, greg k-h