mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: "Andrejczuk, Grzegorz" <grzegorz.andrejczuk@intel.com>
Cc: "mingo@redhat.com" <mingo@redhat.com>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Luc, Piotr" <Piotr.Luc@intel.com>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>
Subject: RE: [Patch v11 4/5] x86/cpufeature: enable RING3MWAIT for Knights Landing
Date: Thu, 22 Dec 2016 12:05:49 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.20.1612221141450.3426@nanos> (raw)
In-Reply-To: <ED52C51D9B87F54892CE544909A13C6C1FF9815F@IRSMSX101.ger.corp.intel.com>

On Thu, 22 Dec 2016, Andrejczuk, Grzegorz wrote:

> > Handing a typecasted unsigned int pointer to a function which expects an
> > unsigned long pointer is just broken and a clear sign of careless
> > tinkering.
> 
> I thought this to be 32 issue because it popped up in 32 build.

It also warns on the 64bit build.

> The reason for this is probably that sizeof(int) is equal to sizeof(long)
> on x64.

Huch? sizeof(int) is equal to sizeof(long) on 32bit, but definitely not on 64 bit.

> I used the cast following set_cpu_cap define which does exactly the same
> thing with u32* type.

set_cpu_cap() operates on 'c->x86_capability', which is an array of u32 and
the bit numbers are linear. That works because x86 is little endian. It's
not pretty, but it's not a template for general abuse.

> I used set_bit because I wanted to be sure that this operation to be
> done atomically. There might be data race when multiple values of
> ELF_HWCAP2 will be set by multiple threads.

Touching ELF_HWCAP2 from anything else than the boot cpu is pointless
anyway. This should be done once.

Aside of that CPU bringup and therefor the call to init_intel() is
serialized by the cpu hotplug code and if we lift that, then ELF_HWCAP2
will be the least of our worries.

Thanks,

	tglx

  reply	other threads:[~2016-12-22 11:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-20 13:48 [PATCH v11 0/5] Enabling Ring 3 MONITOR/MWAIT feature " Grzegorz Andrejczuk
2016-12-20 13:48 ` [PATCH v11 1/5] x86/msr: add MSR_MISC_FEATURE_ENABLES and RING3MWAIT bit Grzegorz Andrejczuk
2016-12-21 20:23   ` Thomas Gleixner
2016-12-22  9:10     ` Andrejczuk, Grzegorz
2016-12-20 13:48 ` [PATCH v11 2/5] x86/elf: add HWCAP2 to expose ring 3 MONITOR/MWAIT Grzegorz Andrejczuk
2016-12-20 13:48 ` [PATCH v11 3/5] x86/cpufeature: add RING3MWAIT to CPU features Grzegorz Andrejczuk
2016-12-20 13:48 ` [PATCH v11 4/5] x86/cpufeature: enable RING3MWAIT for Knights Landing Grzegorz Andrejczuk
2016-12-20 18:31   ` [Patch " Grzegorz Andrejczuk
2016-12-21 20:24     ` Thomas Gleixner
2016-12-22 10:19       ` Andrejczuk, Grzegorz
2016-12-22 11:05         ` Thomas Gleixner [this message]
2016-12-22 11:37           ` Andrejczuk, Grzegorz
2016-12-22 14:20             ` Thomas Gleixner
2016-12-23 18:19               ` Andrejczuk, Grzegorz
2016-12-20 13:48 ` [PATCH v11 5/5] x86/cpufeature: enable RING3MWAIT for Knights Mill Grzegorz Andrejczuk
2017-01-03 22:09 ` [PATCH v11 0/5] Enabling Ring 3 MONITOR/MWAIT feature for Knights Landing Pavel Machek
2017-01-09  8:59   ` Thomas Gleixner
2017-01-09  9:12     ` Pavel Machek

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=alpine.DEB.2.20.1612221141450.3426@nanos \
    --to=tglx@linutronix.de \
    --cc=Piotr.Luc@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=grzegorz.andrejczuk@intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=x86@kernel.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

all inboxes | Powered by JetHome®