public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: hpa@zytor.com, peterz@infradead.org, mingo@kernel.org,
	tglx@linutronix.de, linux-kernel@vger.kernel.org,
	torvalds@linux-foundation.org, ak@linux.intel.com
Cc: linux-tip-commits@vger.kernel.org
Subject: Re: [tip:x86/fpu] bitops: Add clear/set_bit32() to linux/bitops.h
Date: Sun, 5 Nov 2017 16:53:34 +0100	[thread overview]
Message-ID: <20171105155334.GA3225@osiris> (raw)
In-Reply-To: <tip-cbe96375025e14fc76f9ed42ee5225120d7210f8@git.kernel.org>

On Tue, Oct 17, 2017 at 09:21:46AM -0700, tip-bot for Andi Kleen wrote:
> Commit-ID:  cbe96375025e14fc76f9ed42ee5225120d7210f8
> Gitweb:     https://git.kernel.org/tip/cbe96375025e14fc76f9ed42ee5225120d7210f8
> Author:     Andi Kleen <ak@linux.intel.com>
> AuthorDate: Fri, 13 Oct 2017 14:56:41 -0700
> Committer:  Ingo Molnar <mingo@kernel.org>
> CommitDate: Tue, 17 Oct 2017 17:14:56 +0200
> 
> bitops: Add clear/set_bit32() to linux/bitops.h
> 
> Add two simple wrappers around set_bit/clear_bit() that accept
> the common case of an u32 array. This avoids writing
> casts in all callers.
> 
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
> Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Link: http://lkml.kernel.org/r/20171013215645.23166-2-andi@firstfloor.org
> Signed-off-by: Ingo Molnar <mingo@kernel.org>
> ---
>  include/linux/bitops.h | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)

...

> + * set_bit32 - Set a bit in memory for u32 array
> + * @nr: Bit to clear
> + * @addr: u32 * address of bitmap
> + *
> + * Same as set_bit, but avoids needing casts for u32 arrays.
> + */
> +
> +static __always_inline void set_bit32(long nr, volatile u32 *addr)
> +{
> +	set_bit(nr, (volatile unsigned long *)addr);
> +}

This does not work at all on 64 bit big endian machines. If e.g. the array
would contain only one 32 bit member set_bit() would write to whatever is
behind the array.

  reply	other threads:[~2017-11-05 15:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-13 21:56 Support generic disabling of all XSAVE features Andi Kleen
2017-10-13 21:56 ` [PATCH v10 1/5] bitops: Add clear/set_bit32 to linux/bitops.h Andi Kleen
2017-10-17 15:14   ` Thomas Gleixner
2017-10-17 16:21   ` [tip:x86/fpu] bitops: Add clear/set_bit32() " tip-bot for Andi Kleen
2017-11-05 15:53     ` Heiko Carstens [this message]
2017-11-05 17:40       ` Ingo Molnar
2017-11-05 18:01       ` Linus Torvalds
2017-10-13 21:56 ` [PATCH v10 2/5] x86/cpuid: Add generic table for cpuid dependencies Andi Kleen
2017-10-17 16:22   ` [tip:x86/fpu] x86/cpuid: Add generic table for CPUID dependencies tip-bot for Andi Kleen
2017-10-13 21:56 ` [PATCH v10 3/5] x86/fpu: Parse clearcpuid= as early XSAVE argument Andi Kleen
2017-10-17 15:15   ` Thomas Gleixner
2017-10-17 15:19     ` Ingo Molnar
2017-10-17 16:22   ` [tip:x86/fpu] " tip-bot for Andi Kleen
2017-10-13 21:56 ` [PATCH v10 4/5] x86/fpu: Make XSAVE check the base CPUID features before enabling Andi Kleen
2017-10-17 16:23   ` [tip:x86/fpu] " tip-bot for Andi Kleen
2017-10-13 21:56 ` [PATCH v10 5/5] x86/fpu: Remove the explicit clearing of XSAVE dependend features Andi Kleen
2017-10-17 16:23   ` [tip:x86/fpu] x86/fpu: Remove the explicit clearing of XSAVE dependent features tip-bot for Andi Kleen

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=20171105155334.GA3225@osiris \
    --to=heiko.carstens@de.ibm.com \
    --cc=ak@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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