From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753401AbbFLInI (ORCPT ); Fri, 12 Jun 2015 04:43:08 -0400 Received: from cantor2.suse.de ([195.135.220.15]:46737 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753334AbbFLInD (ORCPT ); Fri, 12 Jun 2015 04:43:03 -0400 Date: Fri, 12 Jun 2015 10:42:51 +0200 From: Borislav Petkov To: Andy Lutomirski Cc: Peter Zijlstra , Thomas Gleixner , John Stultz , Aaron Lu , Tony Li , "Rafael J. Wysocki" , Suravee Suthikulanit , =?utf-8?B?RnLDqWTDqXJpYw==?= Weisbecker , "linux-kernel@vger.kernel.org" , Fengguang Wu , Len Brown , Ken Xue , Huang Rui , X86 ML Subject: Re: [PATCH v2 3/4] x86, mwaitt: introduce mwaix delay with a configurable timer Message-ID: <20150612084251.GB9257@pd.tnic> References: <1433819621-15093-1-git-send-email-ray.huang@amd.com> <1433819621-15093-4-git-send-email-ray.huang@amd.com> <20150609092952.GR3644@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 09, 2015 at 09:46:52AM -0700, Andy Lutomirski wrote: > I don't like this hack. The compiler is entirely within is rights to > poke addr's cacheline (i.e. the stack) between the two instructions. > I'd suggest either making the thing a full cacheline long or using a > single asm statement. How about this: /* * This should be a memory location in a cache line which is * unlikely to be touched by other processors. The actual * content is immaterial as it is not actually modified in any way. */ mwait_ptr = ¤t_thread_info()->flags; and then __monitor(mwait_ptr, 0, 0); We already do this in mwait_play_dead(). However, am I even correct in assuming that ->flags won't really be touched as we're doing delay() and nothing pokes into current anyway? Thanks. -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. --