From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933472AbcAMJs3 (ORCPT ); Wed, 13 Jan 2016 04:48:29 -0500 Received: from www.linutronix.de ([62.245.132.108]:48021 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932074AbcAMJs0 (ORCPT ); Wed, 13 Jan 2016 04:48:26 -0500 Date: Wed, 13 Jan 2016 10:47:26 +0100 (CET) From: Thomas Gleixner To: Jacob Pan cc: LKML , Linux PM , Rafael Wysocki , "H. Peter Anvin" , Ingo Molnar , X86 Kernel , Srinivas Pandruvada , Peter Zijlstra Subject: Re: [PATCH v2 2/2] powercap/rapl: reduce ipi calls In-Reply-To: <1452647483-14244-3-git-send-email-jacob.jun.pan@linux.intel.com> Message-ID: 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> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 12 Jan 2016, Jacob Pan wrote: > @@ -805,30 +809,18 @@ static int rapl_write_data_raw(struct rapl_domain *rd, > enum rapl_primitives prim, > unsigned long long value) > { > - u64 msr_val; > - u32 msr; > struct rapl_primitive_info *rp = &rpi[prim]; > int cpu; > + u64 bits; > > cpu = find_active_cpu_on_package(rd->package_id); > if (cpu < 0) > return cpu; > - msr = rd->msrs[rp->id]; > - if (rdmsrl_safe_on_cpu(cpu, msr, &msr_val)) { > - dev_dbg(&rd->power_zone.dev, > - "failed to read msr 0x%x on cpu %d\n", msr, cpu); > - return -EIO; > - } > - value = rapl_unit_xlate(rd, rd->package_id, rp->unit, value, 1); > - msr_val &= ~rp->mask; > - msr_val |= value << rp->shift; > - if (wrmsrl_safe_on_cpu(cpu, msr, msr_val)) { > - dev_dbg(&rd->power_zone.dev, > - "failed to write msr 0x%x on cpu %d\n", msr, cpu); > - return -EIO; > - } > > - return 0; > + bits = rapl_unit_xlate(rd, rd->package_id, rp->unit, value, 1); > + bits |= bits << rp->shift; > + > + return rmwmsrl_safe_on_cpu(cpu, rd->msrs[rp->id], rp->mask, bits); So here you actually use that new (misnomed) function, but for > +static void power_limit_irq_save_cpu(void *info) and > +static void power_limit_irq_restore_cpu(void *info) you use a bog standard smp function call. What's the benefit of adding that rmw function over a bog standard smp function call if you can only use it for one instance of the same pattern? Boris asked you the same question here https://lkml.kernel.org/r/20151220152749.GA29805@pd.tnic but you decided to ignore it. Thanks, tglx