Live-Patching Archive mirror
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Joe Lawrence <joe.lawrence@redhat.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	Jiri Kosina <jikos@kernel.org>, Miroslav Benes <mbenes@suse.cz>,
	linux-kselftest@vger.kernel.org, live-patching@vger.kernel.org,
	linux-s390@vger.kernel.org
Subject: Re: selftests/livepatch fails on s390
Date: Wed, 20 Dec 2023 14:19:54 +0100	[thread overview]
Message-ID: <ZYLpw5vN0d0BbJSL@alley> (raw)
In-Reply-To: <8adb8209-d49b-4feb-5ab3-47ca4f3cefbc@redhat.com>

On Tue 2023-12-19 09:50:18, Joe Lawrence wrote:
> On 12/19/23 04:45, Alexander Gordeev wrote:
> > On Mon, Dec 18, 2023 at 05:44:54PM -0500, Joe Lawrence wrote:
> > 
> >> @@ -280,7 +268,13 @@ function set_pre_patch_ret {
> >>  function start_test {
> >>  	local test="$1"
> >>  
> >> -	save_dmesg
> >> +	# Dump something unique into the dmesg log, then stash the entry
> >> +	# in LAST_DMESG.  The check_result() function will use it to
> >> +	# find new kernel messages since the test started.
> >> +	local timestamp="$(date --rfc-3339=ns)"
> >> +	log "livepatch kselftest timestamp: $timestamp"
> >> +	LAST_DMESG=$(dmesg | grep "livepatch kselftest timestamp: $timestamp")

I like this approach.

> > Not sure if it not paranoid mode, but still..
> > If the 'log' call is guaranteed synced? AKA would 'grep' always catch the line?

I believe that the write is synchronized. The "log" command does:

function log() {
	echo "$1" > /dev/kmsg
}

The message is stored into the log buffer during the write to
/dev/kmsg(). See devkmsg_emit() in devkmsg_write(), where
devkmsg_write() is .write_iter callback in struct file_operations.

const struct file_operations kmsg_fops = {
	.open = devkmsg_open,
	.read = devkmsg_read,
	.write_iter = devkmsg_write,
	.llseek = devkmsg_llseek,
	.poll = devkmsg_poll,
	.release = devkmsg_release,
};

I would explect that the write() callback is called directly when
shell is writing "echo" stdout to /dev/kmsg.

I hope that all this is sychronous. Everything is in memory.
I think that write operations are asynchronous only when
the data are written to a disk or another "slow" medium.

And dmesg reads the data from the ring buffer as well. It is
actually using /dev/kmsg as well by default.

Best Regards,
Petr

      parent reply	other threads:[~2023-12-20 13:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-18 10:44 selftests/livepatch fails on s390 Alexander Gordeev
2023-12-18 16:44 ` Joe Lawrence
2023-12-18 22:44   ` Joe Lawrence
2023-12-19  9:45     ` Alexander Gordeev
2023-12-19 14:50       ` Joe Lawrence
2023-12-19 15:23         ` Alexander Gordeev
2023-12-20 13:19         ` Petr Mladek [this message]

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=ZYLpw5vN0d0BbJSL@alley \
    --to=pmladek@suse.com \
    --cc=agordeev@linux.ibm.com \
    --cc=jikos@kernel.org \
    --cc=joe.lawrence@redhat.com \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mbenes@suse.cz \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).