Received: by 10.223.164.221 with SMTP id h29csp265467wrb; Fri, 3 Nov 2017 08:48:26 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Rmq8YNo32DSYqj0h/dHl1JquNJMux35tjJURe+XPK07fCoHKXNGqbIYmhJOWCBnZzCuhg5 X-Received: by 10.101.85.9 with SMTP id f9mr7587189pgr.263.1509724106669; Fri, 03 Nov 2017 08:48:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509724106; cv=none; d=google.com; s=arc-20160816; b=GobGS5nleqmyGca5yoy4sV3GHktkT37CHvo2NaRj8F7F3kk8hesiKXtJ8BIYmAI/EL 9uohl9n9HPrnIYrhs1gLcqRk1VqwUkPlvSe06NB1mmGIYLWR+jeFnwIpk+Y1+iSWkrbc YRABax8egjTMaM0yQcnFXGgAKmqsrgRHXZZ5HRucI92gZlf3iI7SA3d6RiBxKGLZOMKA HXH/KdlGK01Tl65j1/KbmkzPmtIGfN91U5WvzE+5FSlL7VqUi6/Rxsc91IezA8IftYyJ URbE88lYLibzhBxoH6FlhMGXw05zCgPyZdWO4rUXiWP4y9+ni2sLZG3kYjI4b2nw6GpC yflg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=aa/dd+yULeEd2tozSRAe3+SQSsqKVNoDrXg5yIiyFIE=; b=uXAFa7i83NGUv5w/kaWjAEMkmuAS7lRDNoHhurFU6ce+NcF/gk3lLtpqUATX23aP0k Pm61Wfe7uT/xaQcK00e/uq2GJNyB7Y0Ttv8bJzJgRVqm6lW2FdZgJaN6L627a+nwcPhr 1R+xazMf+CiCs1Cqnef2d4I2G0XMzKf5rmCrtTiVjnbjjtG3deKSTnFWdeAyZPqDOyYv VaNA4kBAFIf1llEG1Jfp+CueEXEjFTd6tk1TMFMFyT3wSbZ8TtKJL4RxYWxOd0VwYA9s A9GKAsW1ePlhdIP6ofi0BNCeQQK3r51NjtumFGYxE8qBaGDeBWV5MnbHhCXdmlFkRFIH 1w5g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x6si6109977pgr.299.2017.11.03.08.48.11; Fri, 03 Nov 2017 08:48:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756053AbdKCPq5 (ORCPT + 95 others); Fri, 3 Nov 2017 11:46:57 -0400 Received: from mx2.suse.de ([195.135.220.15]:49668 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752159AbdKCPqy (ORCPT ); Fri, 3 Nov 2017 11:46:54 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 8031AAD95; Fri, 3 Nov 2017 15:46:52 +0000 (UTC) Date: Fri, 3 Nov 2017 16:46:51 +0100 From: Petr Mladek To: Kroah-Hartman Cc: Calvin Owens , Sergey Senozhatsky , Steven Rostedt , linux-api@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH 2/3] printk: Add /sys/consoles/ interface Message-ID: <20171103154651.GJ20040@pathway.suse.cz> References: <08c1dc1a96afd6b6aecc5ff3c7c0e62c36670893.1506644730.git.calvinowens@fb.com> <20171103142114.GG31148@pathway.suse.cz> <20171103143234.GA7801@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171103143234.GA7801@kroah.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 2017-11-03 15:32:34, Kroah-Hartman wrote: > > > diff --git a/Documentation/ABI/testing/sysfs-consoles b/Documentation/ABI/testing/sysfs-consoles > > > new file mode 100644 > > > index 0000000..6a1593e > > > --- /dev/null > > > +++ b/Documentation/ABI/testing/sysfs-consoles > > > @@ -0,0 +1,13 @@ > > > +What: /sys/consoles/ > > Eeek, what! > > > I rather add Greg in CC. I am not 100% sure that the top level > > directory is the right thing to do. > > Neither do I. > > > Alternative might be to hide this under /sys/kernel/consoles/. > > No no no. > > > > diff --git a/include/linux/console.h b/include/linux/console.h > > > index a5b5d79..76840be 100644 > > > --- a/include/linux/console.h > > > +++ b/include/linux/console.h > > > @@ -148,6 +148,7 @@ struct console { > > > void *data; > > > struct console *next; > > > int level; > > > + struct kobject *kobj; > > Why are you using "raw" kobjects and not a "real" struct device? This > is a device, use that interface instead please. Hmm, struct console has a member struct tty_driver *(*device)(struct console *, int *); but it is set only when the console has tty binding. > If you need a console 'bus' to place them on, fine, but the virtual bus > is probably best and simpler to use. > > That is if you _really_ feel you need sysfs interaction with the console > layer (hint, I am not yet convinced...) The purpose of this patch is to make a userfriendly interface for setting console-specific loglevel (message filtering). It curretnly uses kobject for creating a simple directory structure under /sys/. It is inspired by /sys/power/, /sys/kernel/mm/, /sys/kernel/debug/tracing/ stuff. There are ideas to add more files that would allow to modify even the global setting. This is currectly possible by the four numbers in /proc/sys/kernel/printk. Nobody knows what the four numbers mean. IMHO, the following interface would be easier to work with: /sys/console/loglevel /sys/console/min_loglevel /sys/condole/default_loglevel > > /* > > * Find the related struct console a safe way. The kobject > > * desctruction is asynchronous. > > */ > > > + console_lock(); > > > + for_each_console(con) { > > > + if (con->kobj == kobj) { > > You are doing something wrong, go from kobj to your console directly, > the fact that you can not do that here is a _huge_ hint that your > structure is not correct. > > Hint, it's not correct at all :) I know that we are not following the original purpose of sysfs. But there are more (mis)users. > Please cc: me on stuff like this if you want a review, and as you are > adding a random new sysfs root directory, please always cc: me on that > so I can talk you out of it... Good to know. Best Regards, Petr From 1583055809901777594@xxx Fri Nov 03 14:34:27 +0000 2017 X-GM-THRID: 1579832740601012796 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread