Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp7297162pxb; Thu, 18 Feb 2021 06:38:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJzGnDq95r3YXAlVLGaTIc2drx6q89KWtBVx9Y5/5Es0Lj9BFMQhJHqheLPzcVmTSabzIWSP X-Received: by 2002:a05:6402:26d5:: with SMTP id x21mr4475184edd.50.1613659108188; Thu, 18 Feb 2021 06:38:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613659108; cv=none; d=google.com; s=arc-20160816; b=Y4PMwNah7+SE4IukM9d+25JkCFbJ8xrxyj+0KSE8eurML+kg+qijhvlZrZXkG+dcom N/TchqT6/+MQoBK9oeT3UKl0pDLDt9iIuTczszmKQGnZiIIGVvybkRyNi+Sx/wFWPZIj wboPgdWyxhYuJ1m/Bal864eyh5GDbaJqrKfti6NSWNkiirMPIA+XqS8mcWEvOBR8taoq Aty8tIEryWnc3l1Gu3gYiFSGeuC7l0WcQP2eQEgaVXXmS/A3E6CTYxoNQApqaI46lPeI rKKNpdfMej0YziHphFri9Y8xb6yr559EvBb21kMAo2i9znygvw4KoHZnkEtaJSCTyvuU 7Yzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=2yM4QIJUWbnv3qV7hB4p/81CEeJSilGooTOMXeB9PUs=; b=evQ6CtWXsKstFpqHQmH3ldw7wn1XVAAmhNidrwnc1Z6d6TGnGAAA1XpzMklG3o65hg KrBux3wpPURsriz4zBIoPoXGin3QIEgj+ZJzghh+VHFGenM0ONaGXoZ2cj+O8+Hwiqbt seSN2ybLdr/Bju4IihbGFBmXqSwXH8jplVvLmtXqGwOu+MNGkYTxLVs9rYYVNIe8XfWY yZFrPrWy6HTbrDThOZ692AxsY8MJWsyy879l8YrKjg3wuMo9a8MhKCo6LdGLqkYMgzpD K/ohLt0uTrYoKUb9htzeN3ozhztjGBjpBh4DjiBxPvyMndotuII5X85J5Pmwfe1FCF8X FnBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chrisdown.name header.s=google header.b=ZgM2FNfs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chrisdown.name Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r1si4000435ejp.0.2021.02.18.06.38.02; Thu, 18 Feb 2021 06:38:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chrisdown.name header.s=google header.b=ZgM2FNfs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chrisdown.name Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232270AbhBROc1 (ORCPT + 99 others); Thu, 18 Feb 2021 09:32:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232937AbhBRMmW (ORCPT ); Thu, 18 Feb 2021 07:42:22 -0500 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1311AC06178A for ; Thu, 18 Feb 2021 04:41:41 -0800 (PST) Received: by mail-wm1-x336.google.com with SMTP id o82so3494924wme.1 for ; Thu, 18 Feb 2021 04:41:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chrisdown.name; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=2yM4QIJUWbnv3qV7hB4p/81CEeJSilGooTOMXeB9PUs=; b=ZgM2FNfs7o9TAWAekIEDSwUHlRQJ/N6cfdg7dInG++laCTbXZDcPCcwEpAnqkQE5Xq bZybIRR8lSn+BT6HcZ2Xi3HWsdyPVwV4BtOPvGBrX9beN4qTvI2CuZVxt3+2UPlEDHcO xF24S8tJpaHtJ7EngNI+Acgobz1M8IEpuwC3c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=2yM4QIJUWbnv3qV7hB4p/81CEeJSilGooTOMXeB9PUs=; b=T6yvc0JehTO09COJ2nt3GshTSz3q3nIlLdMODRihNikmH47ediNid+TuGyR8+QOFg4 o7TRMyM2T4k7HrNbN/JadUGIThpS/VTRTbzE9vWWfX0mB/TN7YkpCWv1AxaBBf/A+CyL 9XVog8euXg7NSdaYpJxfUg2xYs1csaCxy3FU1QbwOqNlmiZkOauNoK4LfoZMxjfa/orI XmRQAuqoThyH+/ejvPp1OekIUkiErwjt43cy/e3nBpD2RxI9K46VX6+oFaLFQm6dOkZq 5759Gahr0ubA/f9NLDpgALRtdbF4QgR+PZhnzjRAyRJ/vVdnEsXkm+NGdjWGmUZf07Qt A+ZQ== X-Gm-Message-State: AOAM533DugjjEkoeuBY2R0XZLewdDfWjEyjqTN9qOJaRrBdGbCpccwJu tD5X7rJtRr/gaRtxDVbWSofaVw== X-Received: by 2002:a1c:60c1:: with SMTP id u184mr3515552wmb.22.1613652099731; Thu, 18 Feb 2021 04:41:39 -0800 (PST) Received: from localhost ([2620:10d:c093:400::4:f7e9]) by smtp.gmail.com with ESMTPSA id o13sm9699836wro.15.2021.02.18.04.41.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 04:41:39 -0800 (PST) Date: Thu, 18 Feb 2021 12:41:39 +0000 From: Chris Down To: Petr Mladek Cc: linux-kernel@vger.kernel.org, Sergey Senozhatsky , John Ogness , Johannes Weiner , Andrew Morton , Steven Rostedt , Greg Kroah-Hartman , Kees Cook , kernel-team@fb.com Subject: Re: [PATCH v4] printk: Userspace format enumeration support Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.0.5 (da5e3282) (2021-01-21) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Petr Mladek writes: >> - Move to another file, kernel/printk/debug_formats.c or similar > >Just to be sure. The filename should be ideally based on the configure >option and API names, e.g. formats_index.c or so. > >The printk_ prefix is not strictly necessary. The file is in printk/ >directory. IMHO, we should have used ringbuffer.c but ... Sure thing. >> - Use `struct module *mod` instead of calling it module >> - Add documentation for printk_fmt_sec (or whatever it will be called) >> - Rename things to pf_, pi_, or something >> - See if it's safe to pass a printk_fmt_sec to seq_file instead of a module > >Also it might be needed to store the pointer to struct module. You mean, have a `struct module` entry for this? I somewhat suspect that module.c maintainers are not likely to be happy about injecting non-generic code into there if it's possible to be avoided, but maybe I'm misunderstanding? >Both things together might allow to remove the global hash table and likely >even the mutex. > >> - Handle cont + level >> - Don't expose level/KERN_SOH directly > >I can't remember anything else. I am curious how v5 would look like. You can join the club on that one... ;-) Let me know if I understood you correctly on the `struct module` point, and after that I'll start work on v5. Thanks!