public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Peter Oskolkov <posk@google.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	"Paul E . McKenney" <paulmck@kernel.org>,
	Boqun Feng <boqun.feng@gmail.com>,
	linux-kernel@vger.kernel.org, Paul Turner <pjt@google.com>,
	Chris Kennelly <ckennelly@google.com>,
	Peter Oskolkov <posk@posk.io>
Subject: Re: [PATCH 1/2 v3] rseq/membarrier: add MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ
Date: Tue, 11 Aug 2020 09:54:20 +0200	[thread overview]
Message-ID: <20200811075420.GA5637@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <20200811062733.GP3982@worktop.programming.kicks-ass.net>

On Tue, Aug 11, 2020 at 08:27:33AM +0200, Peter Zijlstra wrote:
>  SYSCALL_DEFINE2(membarrier, int, cmd, int, flags)
>  {
> +	int cflags = 0, int cpuid = -1;
> +
>  	if (unlikely(flags) && cmd != MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ)
>  		return -EINVAL;
> +
> +	if (cmd & (MEMBARRIER_CMD_PRIVATE_EXPEDITED |
> +		   MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE |
> +		   MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ)) {
> +
> +		if (cmd & MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ)
> +			cflags |= MEMBARRIER_FLAG_RSEQ;
> +
> +		if (cmd & MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE) {
> +			cflags |= MEMBARRIER_FLAG_SYNC_CORE;
> +			cpuid = flags;
> +		}
> +
> +		cmd = MEMBARRIER_CMD_PRIVATE_EXPEDITED;
> +	}

This of course fails to check if other bits are set, and it goes really
'funny' if you use cpuid != -1.

That all needs a little more thought.

  reply	other threads:[~2020-08-11  7:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-11  0:09 [PATCH 1/2 v3] rseq/membarrier: add MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ Peter Oskolkov
2020-08-11  0:09 ` [PATCH 2/2 v3] rseq/selftests: test MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ Peter Oskolkov
2020-08-12 20:11   ` Mathieu Desnoyers
2020-08-11  6:27 ` [PATCH 1/2 v3] rseq/membarrier: add MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ Peter Zijlstra
2020-08-11  7:54   ` Peter Zijlstra [this message]
2020-08-11 21:08   ` Peter Oskolkov
2020-08-12 18:30     ` Mathieu Desnoyers
2020-08-12 18:48       ` Peter Oskolkov
2020-08-12 19:44         ` Mathieu Desnoyers
2020-08-20 17:42           ` Peter Oskolkov
2020-08-25 16:58             ` Mathieu Desnoyers
2020-08-25 17:22               ` Peter Oskolkov

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=20200811075420.GA5637@worktop.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=boqun.feng@gmail.com \
    --cc=ckennelly@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=paulmck@kernel.org \
    --cc=pjt@google.com \
    --cc=posk@google.com \
    --cc=posk@posk.io \
    /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