public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: peterz@infradead.org
To: Vincent Donnefort <vincent.donnefort@arm.com>
Cc: mingo@redhat.com, vincent.guittot@linaro.org,
	linux-kernel@vger.kernel.org, dietmar.eggemann@arm.com,
	lukasz.luba@arm.com, valentin.schneider@arm.com
Subject: Re: [PATCH] sched/fair: provide u64 read for 32-bits arch helper
Date: Tue, 28 Jul 2020 14:00:27 +0200	[thread overview]
Message-ID: <20200728120027.GN43129@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20200728111302.GV119549@hirez.programming.kicks-ass.net>

On Tue, Jul 28, 2020 at 01:13:02PM +0200, peterz@infradead.org wrote:
> On Mon, Jul 27, 2020 at 04:23:03PM +0100, Vincent Donnefort wrote:
> 
> > For 32-bit architectures, both min_vruntime and last_update_time are using
> > similar access. This patch is simply an attempt to unify their usage by
> > introducing two macros to rely on when accessing those. At the same time, it
> > brings a comment regarding the barriers usage, as per the kernel policy. So
> > overall this is just a clean-up without any functional changes.
> 
> Ah, I though there was perhaps the idea to make use of armv7-lpae
> instructions.
> 
> Aside of that, I think we need to spend a little time bike-shedding the
> API/naming here:
> 
> > +# define u64_32read(val, copy) (val)
> > +# define u64_32read_set_copy(val, copy) do { } while (0)
> 
> How about something like:
> 
> #ifdef CONFIG_64BIT
> 
> #define DEFINE_U64_U32(name)	u64 name
> #define u64_u32_load(name)	name
> #define u64_u32_store(name, val)name = val
> 
> #else
> 
> #define DEFINE_U64_U32(name)			\
> 	struct {				\
> 		u64 name;			\
> 		u64 name##_copy;		\
> 	}
> 
> #define u64_u32_load(name)			\
> 	({					\
> 		u64 val, copy;			\
> 		do {				\
> 			val = name;		\
> 			smb_rmb();		\
> 			copy = name##_copy;	\
> 		} while (val != copy);		\

wrong order there; we should first read _copy and then the regular one
of course.

> 		val;
> 	})
> 
> #define u64_u32_store(name, val)		\
> 	do {					\
> 		typeof(val) __val = (val);	\
> 		name = __val;			\
> 		smp_wmb();			\
> 		name##_copy = __val;		\
> 	} while (0)
> 
> #endif

The other approach is making it a full type and inline functions I
suppose.

  reply	other threads:[~2020-07-28 12:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-27 10:59 [PATCH] sched/fair: provide u64 read for 32-bits arch helper vincent.donnefort
2020-07-27 11:24 ` Ingo Molnar
2020-07-27 12:05   ` Vincent Donnefort
2020-07-27 12:38 ` peterz
2020-07-27 15:23   ` Vincent Donnefort
2020-07-28 11:13     ` peterz
2020-07-28 12:00       ` peterz [this message]
2020-07-28 19:53         ` Vincent Donnefort
2020-08-18 18:11           ` Vincent Donnefort
2020-07-28  9:09 ` Lukasz Luba

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=20200728120027.GN43129@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=dietmar.eggemann@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=mingo@redhat.com \
    --cc=valentin.schneider@arm.com \
    --cc=vincent.donnefort@arm.com \
    --cc=vincent.guittot@linaro.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