Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753619AbdC2GZL (ORCPT ); Wed, 29 Mar 2017 02:25:11 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:33365 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753324AbdC2GZJ (ORCPT ); Wed, 29 Mar 2017 02:25:09 -0400 Date: Wed, 29 Mar 2017 08:24:59 +0200 From: Ingo Molnar To: kan.liang@intel.com Cc: peterz@infradead.org, tglx@linutronix.de, mingo@redhat.com, linux-kernel@vger.kernel.org, bp@alien8.de, acme@kernel.org, eranian@google.com, jolsa@kernel.org, ak@linux.intel.com Subject: Re: [PATCH V4 2/2] perf/x86: add sysfs entry to freeze counter on SMI Message-ID: <20170329062459.GA1460@gmail.com> References: <1490751920-44720-1-git-send-email-kan.liang@intel.com> <1490751920-44720-3-git-send-email-kan.liang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1490751920-44720-3-git-send-email-kan.liang@intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1121 Lines: 40 * kan.liang@intel.com wrote: > +static void flip_smm_bit(void *data) > +{ > + int val = *(int *)data; > + > + msr_flip_bit(MSR_IA32_DEBUGCTLMSR, DEBUGCTLMSR_FREEZE_WHILE_SMM_BIT, (bool)val); > +} BTW., you can probably shorten that and remove a type cast by using a more natural type for 'val': static void flip_smm_bit(void *data) { bool set = *(int *)data; msr_flip_bit(MSR_IA32_DEBUGCTLMSR, DEBUGCTLMSR_FREEZE_WHILE_SMM_BIT, set); } Also note that 'set' is the more natural local variable name here as well, as it matches the parameter name of the msr_flip_bit() function. BTW. #2, "MSR_IA32_DEBUGCTLMSR" is a bit of a misnomer, why is 'MSR' mentioned twice? If it was 'MSR_IA32_DEBUGCTL' then it could all be: msr_flip_bit(MSR_IA32_DEBUGCTL, DEBUGCTL_FREEZE_WHILE_SMM_BIT, set); plus if 'FREEZE_WHILE_SMM' is renamed to 'FREEZE_IN_SMM', we'd have: msr_flip_bit(MSR_IA32_DEBUGCTL, DEBUGCTL_FREEZE_IN_SMM_BIT, set); ... which, incidentally, fits into 80 cols nicely. But that's unrelated to your patch, you just made canonical use of the existing nomenclature. Thanks, Ingo