From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757862Ab3DXHrm (ORCPT ); Wed, 24 Apr 2013 03:47:42 -0400 Received: from mail-lb0-f179.google.com ([209.85.217.179]:64323 "EHLO mail-lb0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754609Ab3DXHrk (ORCPT ); Wed, 24 Apr 2013 03:47:40 -0400 Date: Wed, 24 Apr 2013 11:47:35 +0400 From: Cyrill Gorcunov To: Ingo Molnar Cc: Linus Torvalds , Peter Zijlstra , "H. Peter Anvin" , Thomas Gleixner , David Miller , "Theodore Ts'o" , Linux Kernel Mailing List , the arch/x86 maintainers , Network Development , "linux-ext4@vger.kernel.org" , Oleg Nesterov , Frederic Weisbecker , Lin Ming Subject: Re: Unsigned widening casts of binary "not" operations.. Message-ID: <20130424074735.GB1751@moon> References: <20130424072630.GB1780@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130424072630.GB1780@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 24, 2013 at 09:26:30AM +0200, Ingo Molnar wrote: > > * Linus Torvalds wrote: > > > And there's quite a lot of them. Even in my (fairly small) config I use on > > my desktop. And the first warnings I see are in x86 code: > > > > arch/x86/kernel/traps.c:405:16: warning: implicit unsigned widening > > cast of a '~' expression > > arch/x86/kernel/cpu/perf_event_p4.c:912:15: warning: implicit unsigned > > widening cast of a '~' expression > > Hm, the perf_event_p4.c code is indeed confused. > > I think the bug is real but probably benign in effect: we allow narrower > values into the MSR register than probably intended. Only a couple of low > bits are reserved AFAICS. > > Here's an (untested!) patch that tries to untangle it all: it just moves > to clean 64-bit types everywhere - these MSRs are 64-bit wide regardless > of whether we run on 32-bit or not. > > Would be nice if someone with a working P4 could test it - Cyrill? [It > should also be double checked whether the high words are really not > reserved and can be written to ...] Hi Ingo! Ufortunately I don't have access to real p4 hardware, thus I'm CC'ing Ming who has been helping a lot in testing this code pieces. Still the patch itself is perfectly fine to me Reviewed-by: Cyrill Gorcunov