From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932368AbcAMWLT (ORCPT ); Wed, 13 Jan 2016 17:11:19 -0500 Received: from mga14.intel.com ([192.55.52.115]:61997 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932308AbcAMWLQ convert rfc822-to-8bit (ORCPT ); Wed, 13 Jan 2016 17:11:16 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,291,1449561600"; d="scan'208";a="633008786" Date: Wed, 13 Jan 2016 14:11:15 -0800 From: Jacob Pan To: Thomas Gleixner Cc: Srinivas Pandruvada , Borislav Petkov , LKML , Linux PM , Rafael Wysocki , "H. Peter Anvin" , Ingo Molnar , X86 Kernel , Peter Zijlstra , jacob.jun.pan@linux.intel.com Subject: Re: [PATCH v2 2/2] powercap/rapl: reduce ipi calls Message-ID: <20160113141115.59535b45@yairi> In-Reply-To: References: <1452647483-14244-1-git-send-email-jacob.jun.pan@linux.intel.com> <1452647483-14244-3-git-send-email-jacob.jun.pan@linux.intel.com> <20160113082113.3314fa92@icelake> <20160113163610.GH12897@pd.tnic> <20160113095124.186ff487@yairi> <20160113180412.GN12897@pd.tnic> <20160113102138.4e34e890@yairi> <20160113191622.GP12897@pd.tnic> <20160113121003.3e9c2108@yairi> <20160113212602.GT12897@pd.tnic> <1452722083.3092.92.camel@linux.intel.com> Organization: OTC X-Mailer: Claws Mail 3.9.3 (GTK+ 2.24.23; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 13 Jan 2016 23:02:33 +0100 (CET) Thomas Gleixner wrote: > On Wed, 13 Jan 2016, Srinivas Pandruvada wrote: > > On Wed, 2016-01-13 at 22:26 +0100, Borislav Petkov wrote: > > > rmwmsrl_safe_on_cpu(policy->cpu, MSR_IA32_PERF_CTL, > > >     INTEL_PERF_CTL_MASK, > > >     (u32)sfi_cpufreq_array[next_perf_state].ctr > > > l_val & INTEL_PERF_CTL_MASK); > > > > > > Yikes! > > > > > > So yes, it can work but it is ugly, hard to parse and use, not > > > generic > > > enough, etc, etc. > > > > > > So thanks, but no thanks. > > > > > I agree, in some cases it will not make much sense to use read- > > modify_write calls, the user may decide whether it makes sense or > > not. But such interface is not new to Linux kernel: > > > > regmap_update_bits(), which is referenced for 346 times. > > > > Are you saying that any such calls are not useful? > > There are certainly cases when such calls are useful. And those cases > are when we have a sufficiently big occurence of similar code which > is sufficiently complex to justify the library code and the export. > The balance of pros and cons depends on the number of occurrence. The lib call overhead is constant where saving from the callers are multiplied. Anyway, I will go back to my original code until we have enough callers to tip the balance.