xenomai.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Xenomai <xenomai@lists.linux.dev>
Subject: Re: [dovetail-5.10] Re: tracing: irq_pipeline: add pipeline awareness
Date: Fri, 22 Sep 2023 10:18:35 +0200	[thread overview]
Message-ID: <87cyyamx9x.fsf@xenomai.org> (raw)
In-Reply-To: <1eb4952e-f76f-4831-87e1-5effe76700ca@siemens.com>


Jan Kiszka <jan.kiszka@siemens.com> writes:

> Hi Philippe,
>
> what is this fixme in 5.10.y-dovetail-rebase (and only there) about?
>
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index d3e0ae1168069..8d10bdfd8ccf4 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
>
> ...
>
> @@ -7229,10 +7231,10 @@ tracing_snapshot_write(struct file *filp, const char __user *ubuf, size_t cnt,
>  			break;
>  		/* Now, we're going to swap */
>  		if (iter->cpu_file == RING_BUFFER_ALL_CPUS) {
> -			local_irq_disable();
> +			hard_local_irq_disable();
>  			update_max_tr(tr, current, smp_processor_id(), NULL);
> -			local_irq_enable();
> -		} else {
> +			hard_local_irq_enable();
> +		} else {	/* FIXME: irq_pipeline */
>  			smp_call_function_single(iter->cpu_file, tracing_swap_cpu_buffer,
>  						 (void *)tr, 1);
>  		}
>
> To my understanding, tracing_snapshot_write() will only be called in-
> band, no?
>
> Jan

Yes, but I'm still pondering the implications of the in-band vs oob
concurrent accesses on the upstream commit #c5d30d6aa as a fix for a SMP
race between buffer swap & write ops. Assuming this is not an issue
eventually, the code would look like this:

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 8d10bdfd8ccf4..46cdc6ecf64a9 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -7168,7 +7168,9 @@ static int tracing_snapshot_open(struct inode *inode, struct file *file)
 
 static void tracing_swap_cpu_buffer(void *tr)
 {
+	hard_local_irq_disable();
 	update_max_tr_single((struct trace_array *)tr, current, smp_processor_id());
+	hard_local_irq_enable();
 }
 
 static ssize_t
@@ -7234,7 +7236,7 @@ tracing_snapshot_write(struct file *filp, const char __user *ubuf, size_t cnt,
 			hard_local_irq_disable();
 			update_max_tr(tr, current, smp_processor_id(), NULL);
 			hard_local_irq_enable();
-		} else {	/* FIXME: irq_pipeline */
+		} else {
 			smp_call_function_single(iter->cpu_file, tracing_swap_cpu_buffer,
 						 (void *)tr, 1);
 		}
-- 
Philippe.

      parent reply	other threads:[~2023-09-22  8:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-21 17:38 [dovetail-5.10] Re: tracing: irq_pipeline: add pipeline awareness Jan Kiszka
2023-09-21 17:52 ` Jan Kiszka
2023-09-22  8:18 ` Philippe Gerum [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=87cyyamx9x.fsf@xenomai.org \
    --to=rpm@xenomai.org \
    --cc=jan.kiszka@siemens.com \
    --cc=xenomai@lists.linux.dev \
    /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).