From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753649AbbETUQD (ORCPT ); Wed, 20 May 2015 16:16:03 -0400 Received: from cantor2.suse.de ([195.135.220.15]:46683 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752356AbbETUP7 (ORCPT ); Wed, 20 May 2015 16:15:59 -0400 Date: Wed, 20 May 2015 22:15:54 +0200 From: Borislav Petkov To: Thomas Gleixner Cc: One Thousand Gnomes , Ingo Molnar , Huang Rui , Len Brown , "Rafael J. Wysocki" , x86@kernel.org, linux-kernel@vger.kernel.org, Fengguang Wu , Aaron Lu , Tony Li , =?utf-8?B?RnLDqWTDqXJpYw==?= Weisbecker Subject: Re: [RFC PATCH 2/4] x86, mwaitt: introduce mwaitx idle with a configurable timer Message-ID: <20150520201553.GI3645@pd.tnic> References: <20150520102258.GA21245@gmail.com> <20150520105032.GD3645@pd.tnic> <20150520111120.GA25215@gmail.com> <20150520112110.GG3645@pd.tnic> <20150520114125.GA31212@gmail.com> <20150520145122.GB10374@gmail.com> <20150520165558.24bf2483@lxorguk.ukuu.org.uk> <20150520160702.GH3645@pd.tnic> 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 Wed, May 20, 2015 at 09:12:15PM +0200, Thomas Gleixner wrote: > Which would be good enough for mdelay/udelay I think, but we'd need to > measure the time spend in MWAITT so we wont return early. > > Something like this: Yeah, with a check maybe: > delay = usec_to_tsc(delay_usec); if (delay > ((1 << 32) - 1)) { mdelay(delay_usec); return; } > end = rdtsc() + delay; > while (1) { I guess monitorx( ...); first. > MWAITT(delay); > now = rdtsc(); > if (end <= now) > break; > delay = end - now; > } > > Now we'd need to add alternatives or some other mechanism to it to > make this conditionally for those machines. alternative_call(mdelay, mdelayx, X86_FEATURE_MWAITT, /* no output */, timeout); Something like that maybe. > Not sure if it's worth the trouble. Could be a use case for MWAITX in the kernel! :-D -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. --