Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp2918889ybh; Mon, 5 Aug 2019 08:58:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqyU6PYKYawQ+VfLvQ2scGef749lKiA0DxEHmguswe5MhJb64YKtYFRgPtepGPfSf67Xh0qz X-Received: by 2002:aa7:8651:: with SMTP id a17mr73062422pfo.138.1565020722753; Mon, 05 Aug 2019 08:58:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565020722; cv=none; d=google.com; s=arc-20160816; b=HFkwVS9Wvm87iEfKh3AtJ+BMC4xW56nnod3DSMbnoJFYXmlq/NJImodRlgtYrdyY7t bvvW7xj5S1WrONR4clr5oHwXKrmuTSyuIM66NcJ4xElZqnYneKl/CIDFNWWwol5Es5wH EOLIARj22MnZqUglbx9YQ8c79GZattFadw9cY/OhWmRK7xAK8JoenE39JGQljQ6Tnvcq VIZ1pDm8ELLo3OOnWqmUCmWjAIRTr/JwFyJMHf2DZsA/mF37CTVy6GC5xJacLSDHVTLW bpbT5Ooal3gRfdflp7iPkRcYxDOK33MDUe/54m6oipbOV+O/ox3Mo5qIja+W9oF4RcCX hgvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Gi0g2I1SbpSiAESkUfjkocwrvZWSJhT+FGN1+9gI4Qs=; b=fmSbK0NCOmd0rZl8Bj+NftSqXE/7FRecEswXCU/Xp9MOSjvx9I60MvZK2a6ChL5M/i lHI3hkn83JU8IW0a4yztLGhyCGZmzcFGnFmSQb2r1vgttei5ic6XtS3+j4khBUDHqZ0/ eJ+W4uaADQaWJg3L3hslY1Ka7IKaD3//p3ygFeJQ2f/ZpcA2Hl6lNwm7VDG7Ur0oGHpb Mjuy+Z/MvsEXk3aXfa9SJTF+y7JKbMhhMoaASLefhQGK81PGXnPCvYUSq6l5V09w4juX khHbXn4cnve3ZxaDNouT1bBUZm/j8diHPYi+i/fAsDA6U6j2IX/1FbZRkbewRFSVH/MY Z5Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=hqXVQVO1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o12si12629888pjp.72.2019.08.05.08.58.27; Mon, 05 Aug 2019 08:58:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=hqXVQVO1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729270AbfHEP5r (ORCPT + 99 others); Mon, 5 Aug 2019 11:57:47 -0400 Received: from mail.skyhub.de ([5.9.137.197]:34486 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726559AbfHEP5q (ORCPT ); Mon, 5 Aug 2019 11:57:46 -0400 Received: from zn.tnic (p200300EC2F065B00683A29B48F14DC99.dip0.t-ipconnect.de [IPv6:2003:ec:2f06:5b00:683a:29b4:8f14:dc99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 5834E1EC0C31; Mon, 5 Aug 2019 17:57:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1565020664; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=Gi0g2I1SbpSiAESkUfjkocwrvZWSJhT+FGN1+9gI4Qs=; b=hqXVQVO1eBdWSbC2SWJjwNbU1BND9M1CfYpHbUaC4l2NaN/xsnsOZOZ1yXmnmg8R5DPYKU TJunkjyPpqDi7qBrHWcJsQ57V1jc9RJRJ7orpOC0GasXyPwSQxpsuP6X3gPekea8OOEYNR RogX4pSSQcS4sqg53INzn91hAYHyxVk= Date: Mon, 5 Aug 2019 17:57:39 +0200 From: Borislav Petkov To: Reinette Chatre Cc: tglx@linutronix.de, fenghua.yu@intel.com, tony.luck@intel.com, kuo-lang.tseng@intel.com, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V2 04/10] x86/resctrl: Set cache line size using new utility Message-ID: <20190805155739.GB18785@zn.tnic> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 30, 2019 at 10:29:38AM -0700, Reinette Chatre wrote: > In preparation for support of pseudo-locked regions spanning two > cache levels the cache line size computation is moved to a utility. Please write this in active voice: "Move the cache line size computation to a utility function in preparation... " And yes, "a utility" solely sounds like you're adding a tool which does that. But it is simply a separate function. :-) > Setting of the cache line size is moved a few lines earlier, before > the C-states are constrained, to reduce the amount of cleanup needed > on failure. And in general, that passive voice is kinda hard to read. To quote from Documentation/process/submitting-patches.rst: "Describe your changes in imperative mood, e.g. "make xyzzy do frotz" instead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy to do frotz", as if you are giving orders to the codebase to change its behaviour." Please check all your commit messages. > Signed-off-by: Reinette Chatre > --- > arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 42 +++++++++++++++++------ > 1 file changed, 31 insertions(+), 11 deletions(-) > > diff --git a/arch/x86/kernel/cpu/resctrl/pseudo_lock.c b/arch/x86/kernel/cpu/resctrl/pseudo_lock.c > index 110ae4b4f2e4..884976913326 100644 > --- a/arch/x86/kernel/cpu/resctrl/pseudo_lock.c > +++ b/arch/x86/kernel/cpu/resctrl/pseudo_lock.c > @@ -101,6 +101,30 @@ static u64 get_prefetch_disable_bits(void) > return 0; > } > > +/** > + * get_cache_line_size - Determine the cache coherency line size > + * @cpu: CPU with which cache is associated > + * @level: Cache level > + * > + * Context: @cpu has to be online. > + * Return: The cache coherency line size for cache level @level associated > + * with CPU @cpu. Zero on failure. > + */ > +static unsigned int get_cache_line_size(unsigned int cpu, int level) > +{ > + struct cpu_cacheinfo *ci; > + int i; > + > + ci = get_cpu_cacheinfo(cpu); > + > + for (i = 0; i < ci->num_leaves; i++) { > + if (ci->info_list[i].level == level) > + return ci->info_list[i].coherency_line_size; > + } > + > + return 0; > +} > + > /** > * pseudo_lock_minor_get - Obtain available minor number > * @minor: Pointer to where new minor number will be stored > @@ -281,9 +305,7 @@ static void pseudo_lock_region_clear(struct pseudo_lock_region *plr) > */ > static int pseudo_lock_region_init(struct pseudo_lock_region *plr) > { > - struct cpu_cacheinfo *ci; > int ret; > - int i; > > /* Pick the first cpu we find that is associated with the cache. */ > plr->cpu = cpumask_first(&plr->d->cpu_mask); > @@ -295,7 +317,12 @@ static int pseudo_lock_region_init(struct pseudo_lock_region *plr) > goto out_region; > } > > - ci = get_cpu_cacheinfo(plr->cpu); > + plr->line_size = get_cache_line_size(plr->cpu, plr->r->cache_level); > + if (plr->line_size == 0) { if (!plr->...) > + rdt_last_cmd_puts("Unable to determine cache line size\n"); > + ret = -1; > + goto out_region; > + } > > plr->size = rdtgroup_cbm_to_size(plr->r, plr->d, plr->cbm); > > @@ -303,15 +330,8 @@ static int pseudo_lock_region_init(struct pseudo_lock_region *plr) > if (ret < 0) > goto out_region; > > - for (i = 0; i < ci->num_leaves; i++) { > - if (ci->info_list[i].level == plr->r->cache_level) { > - plr->line_size = ci->info_list[i].coherency_line_size; > - return 0; > - } > - } > + return 0; > > - ret = -1; > - rdt_last_cmd_puts("Unable to determine cache line size\n"); > out_region: > pseudo_lock_region_clear(plr); > return ret; > -- > 2.17.2 > -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.