Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755962AbdCWUdL (ORCPT ); Thu, 23 Mar 2017 16:33:11 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:46628 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751706AbdCWUdJ (ORCPT ); Thu, 23 Mar 2017 16:33:09 -0400 Date: Thu, 23 Mar 2017 21:32:55 +0100 From: Peter Zijlstra To: kan.liang@intel.com Cc: mingo@redhat.com, acme@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, eranian@google.com, jolsa@kernel.org, ak@linux.intel.com Subject: Re: [PATCH 1/3] perf/x86: add sysfs entry to freeze counter on SMI Message-ID: <20170323203255.kps67homffxhl3cv@hirez.programming.kicks-ass.net> References: <1490293551-5552-1-git-send-email-kan.liang@intel.com> <1490293551-5552-2-git-send-email-kan.liang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1490293551-5552-2-git-send-email-kan.liang@intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 498 Lines: 11 On Thu, Mar 23, 2017 at 11:25:49AM -0700, kan.liang@intel.com wrote: > + for_each_possible_cpu(cpu) { > + rdmsrl_on_cpu(cpu, MSR_IA32_DEBUGCTLMSR, &debugctlmsr); > + if (val) > + wrmsrl_on_cpu(cpu, MSR_IA32_DEBUGCTLMSR, debugctlmsr | DEBUGCTLMSR_FREEZE_WHILE_SMM); > + else > + wrmsrl_on_cpu(cpu, MSR_IA32_DEBUGCTLMSR, debugctlmsr & ~DEBUGCTLMSR_FREEZE_WHILE_SMM); > + } No; that's just disgusting. Also {rd,wr}msr_on_cpu() should die, exactly because people end up writing crap like this.