linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Marcin Niesluchowski <m.niesluchow@samsung.com>
Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-api@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Tejun Heo <tj@kernel.org>, Kay Sievers <kay@vrfy.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Joe Perches <joe@perches.com>,
	Karol Lewandowski <k.lewandowsk@samsung.com>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Subject: Re: [RFC 3/8] kmsg: introduce additional kmsg devices support
Date: Wed, 8 Jul 2015 13:10:58 +0200	[thread overview]
Message-ID: <20150708111058.GL32664@pathway.suse.cz> (raw)
In-Reply-To: <1435920595-30879-4-git-send-email-m.niesluchow@samsung.com>

On Fri 2015-07-03 12:49:50, Marcin Niesluchowski wrote:
> kmsg device provides operations on cyclic logging buffer used mainly
> by kernel but also in userspace by privileged processes.
> 
> Additional kmsg devices keep the same log format but may be added
> dynamically with custom size.
> 
> Signed-off-by: Marcin Niesluchowski <m.niesluchow@samsung.com>

> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -234,29 +234,37 @@ struct printk_log {
>  	u8 level:3;		/* syslog level */
>  };

Just in case, this is accepted. If you already touch the API, I would
suggest to rename struct printk_log to printk_msg. The current name
is pretty misleading.

> +struct log_buffer {
> +#ifdef CONFIG_PRINTK
> +	struct list_head list;	/* kmsg as head of the list */
> +	char *buf;		/* cyclic log buffer */
> +	u32 len;		/* buffer length */
> +	wait_queue_head_t wait;	/* wait queue for kmsg buffer */
> +#endif
>  /*
> - * The logbuf_lock protects kmsg buffer, indices, counters.  This can be taken
> - * within the scheduler's rq lock. It must be released before calling
> - * console_unlock() or anything else that might wake up a process.
> + * The lock protects kmsg buffer, indices, counters. This can be taken within
> + * the scheduler's rq lock. It must be released before calling console_unlock()
> + * or anything else that might wake up a process.
>   */
> -static DEFINE_RAW_SPINLOCK(logbuf_lock);
> +	raw_spinlock_t lock;
> +	u64 first_seq;		/* sequence number of the first record stored */
> +	u32 first_idx;		/* index of the first record stored */
> +/* sequence number of the next record to store */
> +	u64 next_seq;
> +#ifdef CONFIG_PRINTK
> +	u32 next_idx;		/* index of the next record to store */
> +	int mode;		/* mode of device (kmsg_sys only) */
> +	int minor;		/* minor representing buffer device */
> +#endif
> +};


> @@ -1069,10 +1253,10 @@ const struct file_operations kmsg_fops = {
>   */
>  void log_buf_kexec_setup(void)
>  {
> -	VMCOREINFO_SYMBOL(log_buf);
> -	VMCOREINFO_SYMBOL(log_buf_len);
> -	VMCOREINFO_SYMBOL(log_first_idx);
> -	VMCOREINFO_SYMBOL(log_next_idx);
> +	VMCOREINFO_SYMBOL(log_buf.buf);
> +	VMCOREINFO_SYMBOL(log_buf.len);
> +	VMCOREINFO_SYMBOL(log_buf.first_idx);
> +	VMCOREINFO_SYMBOL(log_buf.next_idx);

Have you tried to use this in crash or some other utility, please?
I guess that it will need to be exported a similar way like
struct printk_log, something like:

	VMCOREINFO_SYMBOL(log_buf);
	VMCOREINFO_STRUCT_SIZE(log_buffer);
	VMCOREINFO_OFFSET(log_buffer, buf);
	VMCOREINFO_OFFSET(log_buffer, len);
	VMCOREINFO_OFFSET(log_buffer, first_idx);
	VMCOREINFO_OFFSET(log_buffer, next_idx);

Best Regards,
Petr

  reply	other threads:[~2015-07-08 11:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-03 10:49 [RFC 0/8] Additional kmsg devices Marcin Niesluchowski
     [not found] ` <1435920595-30879-1-git-send-email-m.niesluchow-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-07-03 10:49   ` [RFC 1/8] printk: move code regarding log message storing format Marcin Niesluchowski
2015-07-03 10:49   ` [RFC 2/8] printk: add one function for storing log in proper format Marcin Niesluchowski
2015-07-03 10:49   ` [RFC 7/8] kmsg: add ioctl for adding and deleting kmsg* devices Marcin Niesluchowski
2015-07-03 10:49   ` [RFC 8/8] kmsg: add ioctl for kmsg* devices operating on buffers Marcin Niesluchowski
2015-07-03 10:49 ` [RFC 3/8] kmsg: introduce additional kmsg devices support Marcin Niesluchowski
2015-07-08 11:10   ` Petr Mladek [this message]
2015-07-03 10:49 ` [RFC 4/8] kmsg: add function for adding and deleting additional buffers Marcin Niesluchowski
2015-07-03 10:49 ` [RFC 5/8] kmsg: device support in mem class Marcin Niesluchowski
     [not found]   ` <1435920595-30879-6-git-send-email-m.niesluchow-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-07-03 15:39     ` Greg Kroah-Hartman
2015-07-03 10:49 ` [RFC 6/8] kmsg: add predefined _PID, _TID, _COMM keywords to kmsg* log dict Marcin Niesluchowski
2015-07-03 11:21 ` [RFC 0/8] Additional kmsg devices Richard Weinberger
     [not found]   ` <CAFLxGvxvaePEyCpLrB1cjNn4bvnCwt-_HE3zcT-6diMYNOraBw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-03 15:09     ` Marcin Niesluchowski
     [not found]       ` <5596A58F.7090208-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-07-03 16:57         ` Andy Lutomirski
2015-07-07 13:11       ` Petr Mladek
2015-07-07 17:10         ` Karol Lewandowski
2015-07-08 10:45           ` Petr Mladek
     [not found]       ` <5596A80D.5040109@nod.at>
2015-07-08  8:30         ` Marcin Niesluchowski
     [not found]           ` <559CE110.70503@nod.at>
2015-07-08 11:17             ` Bartlomiej Zolnierkiewicz

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=20150708111058.GL32664@pathway.suse.cz \
    --to=pmladek@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=b.zolnierkie@samsung.com \
    --cc=corbet@lwn.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=k.lewandowsk@samsung.com \
    --cc=kay@vrfy.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.niesluchow@samsung.com \
    --cc=tj@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).