Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752006AbdC2ESc (ORCPT ); Wed, 29 Mar 2017 00:18:32 -0400 Received: from mga01.intel.com ([192.55.52.88]:48258 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750939AbdC2ESb (ORCPT ); Wed, 29 Mar 2017 00:18:31 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,239,1486454400"; d="scan'208";a="80447321" Date: Tue, 28 Mar 2017 21:18:29 -0700 From: Andi Kleen 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 Subject: Re: [PATCH V4 2/2] perf/x86: add sysfs entry to freeze counter on SMI Message-ID: <20170329041829.GA4543@tassilo.jf.intel.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.8.0 (2017-02-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 472 Lines: 25 > + if (x86_pmu.attr_freeze_on_smi == val) > + return count; > + > + mutex_lock(&freeze_on_smi_mutex); I don't think the mutex is really needed, but if it was it would need to include the previous check too to be atomic. > + > + get_online_cpus(); > + > + flip_smm_bit(&val); > + smp_call_function(flip_smm_bit, &val, 1); > + > + put_online_cpus(); This is on_each_cpu() > + > + x86_pmu.attr_freeze_on_smi = val; > + > + mutex_unlock(&freeze_on_smi_mutex); -Andi