Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp2250701imb; Sun, 3 Mar 2019 23:43:03 -0800 (PST) X-Google-Smtp-Source: APXvYqy/LHFdW/VZGJ14mk/+YiuyM12rYlPFe5Layl51UMB+0O2mJQvaZ+zhbGxvUEmazxBrAPEQ X-Received: by 2002:a17:902:8697:: with SMTP id g23mr19466644plo.30.1551685383025; Sun, 03 Mar 2019 23:43:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551685383; cv=none; d=google.com; s=arc-20160816; b=xTXsjMcwEN5d399sPZVsIOa1oT4EyIjSRv+nc9OXRfxMGoTijwlkKoE8MIwLlSRBRi U0n2ggG2z13rO48Zd/wYuzuvfSFiosc9+4l+qXlJZxgsMiACMZcveMc6soIJ2Nu14Voz LuIk2oD0N5fVKqEMfelkBGjx8xtzN68jqBqeSsCNtlBUeN5C0xsU/OHTcT9WqPvfclb1 RVm7PStUWzbJBjrXKEAV0EXrIzcOIcag239apr9TJ7y9OYOlnAoBlCY2wvM2/WfvKDPO 0tNMTK8ZeVGfAYc9DX8im2CakEM41i+zlcU0z3t3vOH2O/I3n0Yd1qxcCtpUPsPE/bdh Zzjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :dkim-signature; bh=/4dc4k/j2mMqz51OSsTsAvlGPXV+6mw3Om6kcPwBrbg=; b=eaSDo6e5oUfn2KfKcWjozkOVsLScErkeIf5wssE5Uq8o16xlZYXJYSXJnnsUZtBKRo 9pQTJj8E55RaP+rGsEL5DtKjIvd1KOMH8p3M7BuFt9rmtQ8LlLU45JVg/DFqc6xhwwY4 y6gMl2eRGsEELO048814MfL80No1ddKT6NTRtkHlWYA6lWFrFLEjcLmXhtp4npTcb6Hc rMhy91st128T9qYSZpHsLO0orgET2lcr0vyDuuQcq9NX6uQ8USEU7yXDP6yj+OLoYrbO sdmP0gf6ZUhQCYDpNabaACdBiYJnDHoJ2PKNYHe7046QrCIrdczXRJu9T2hyg7PE+iIP IZKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@scalemp.com header.s=default header.b=HZsUcGJX; 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=fail (p=NONE sp=NONE dis=NONE) header.from=scalemp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q22si4876187plr.384.2019.03.03.23.42.47; Sun, 03 Mar 2019 23:43:03 -0800 (PST) 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=fail header.i=@scalemp.com header.s=default header.b=HZsUcGJX; 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=fail (p=NONE sp=NONE dis=NONE) header.from=scalemp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726079AbfCDHmQ (ORCPT + 99 others); Mon, 4 Mar 2019 02:42:16 -0500 Received: from www.scalemp.com ([169.44.78.149]:36232 "EHLO scalemp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725997AbfCDHmQ (ORCPT ); Mon, 4 Mar 2019 02:42:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=scalemp.com ; s=default; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=/4dc4k/j2mMqz51OSsTsAvlGPXV+6mw3Om6kcPwBrbg=; b=HZsUcGJXpfFZWjybMxH+F2GGgI vIve8pxzRO0roSZNeNLHC2kSlpAxbAFHV5BTczMIGkOkKGqi1aJWBHsuZ0o7dHz83urxuAU5ph+df 3wobY/guLEUZD+XDjAAeP966dcPPpRWLgrzo7BogaQ+ZPK3hrf2V+QU3wTvmkcjvX3vY=; Received: from bzq-80-45-146.red.bezeqint.net ([82.80.45.146]:16972 helo=[10.100.0.120]) by hosting.virtualsmp.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.91) (envelope-from ) id 1h0iEo-001U7e-Gw; Mon, 04 Mar 2019 02:42:14 -0500 Subject: Re: [PATCH] percpu/module resevation: change resevation size iff X86_VSMP is set To: Barret Rhoden Cc: dennis@kernel.org, tj@kernel.org, cl@linux.com, linux-kernel@vger.kernel.org, Shai Fultheim , Oren Twaig References: <1548071251-1849-1-git-send-email-eial@scalemp.com> From: Eial Czerwacki Organization: ScaleMP Message-ID: Date: Mon, 4 Mar 2019 09:42:12 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - hosting.virtualsmp.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - scalemp.com X-Get-Message-Sender-Via: hosting.virtualsmp.com: authenticated_id: eial@scalemp.com X-Authenticated-Sender: hosting.virtualsmp.com: eial@scalemp.com X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Greetings Barret, On 3/1/19 8:30 PM, Barret Rhoden wrote: > Hi - > > On 01/21/2019 06:47 AM, Eial Czerwacki wrote: >> > > Your main issue was that you only sent this patch to LKML, but not the > maintainers of the file.  If you don't, your patch might get lost.  To > get the appropriate people and lists, run: > >     scripts/get_maintainer.pl YOUR_PATCH.patch. > > For this patch, you'll get this: > > Dennis Zhou (maintainer:PER-CPU MEMORY ALLOCATOR) > Tejun Heo (maintainer:PER-CPU MEMORY ALLOCATOR) > Christoph Lameter (maintainer:PER-CPU MEMORY ALLOCATOR) > linux-kernel@vger.kernel.org (open list) > > I added the three maintainers to this email. > > I have a few minor comments below. > thanks, I did not knew that, I'll use it next time. >> [PATCH] percpu/module resevation: change resevation size iff X86_VSMP > is set > > You misspelled 'reservation'.  Also, I'd just say: "percpu: increase > module reservation size if X86_VSMP is set".  ('change' -> 'increase'), > only says 'reservation' once.) > >> as reported in bug #201339 >> (https://bugzilla.kernel.org/show_bug.cgi?id=201339) > > I think you can add a tag for this right above your Signed-off-by tags. > e.g.: > > Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=201339 > >> by enabling X86_VSMP, INTERNODE_CACHE_BYTES's definition differs from >> the default one >> causing the struct size to exceed the size ok 8KB. >                                             ^of > will fix, thanks. > Which struct are you talking about?  I have one in mind, but others > might not know from reading the commit message. > > I ran into this on https://bugzilla.kernel.org/show_bug.cgi?id=202511. > In that case, it was because modules (drm and amdkfd) were using > DEFINE_SRCU, which does a DEFINE_PER_CPU on struct srcu_data, and that > used ____cacheline_internodealigned_in_smp. you are correct, the structure in question is struct srcu_data. > >> >> in order to avoid such issue, increse PERCPU_MODULE_RESERVE to 64KB if >> CONFIG_X86_VSMP is set. >                                ^increase > >> >> the value was caculated on linux 4.20.3, make allmodconfig all and the >> following oneliner: >                ^calculated > will fix, thanks. >> for f in `find -name *.ko`; do echo $f; readelf -S $f  |grep perc; >> done |grep data..percpu -B 1 |grep ko |while read r; do echo -n "$r: >> "; objdump --syms --section=.data..percpu $r|grep data |sort -n  |awk >> '{c++; d=strtonum("0x" $1) + strtonum("0x" $5); if (m < d) m = d;} END >> {printf("%d vars-> last addr 0x%x ( %d )\n", c, m, m)}' ; done |column >> -t |sort -k 8 -n | awk '{print $8}'| paste -sd+ | bc > > Not sure how useful the one-liner is, versus a description of what > you're doing.  i.e. "the size of all module percpu data sections, or > something." I thought an easy reproducing will suffice, I'll take that into account. > > Also, how close was that calculated value to 64K?  If more modules start > using DEFINE_SRCU, each of which uses 8K, then that 64K might run out. the biggest module was 12472 bytes in size, as multiple modules uses the same percpu, more is needed, the only way I was able to make it fit was 64K. of course there is a possibility that at a specific scenario 64K will not be enough but we have yet to encounter such scenario. > > Thanks, > Barret > >> Signed-off-by: Eial Czerwacki >> Signed-off-by: Shai Fultheim >> Signed-off-by: Oren Twaig >> --- >>   include/linux/percpu.h | 4 ++++ >>   1 file changed, 4 insertions(+) >> >> diff --git a/include/linux/percpu.h b/include/linux/percpu.h >> index 70b7123..6b79693 100644 >> --- a/include/linux/percpu.h >> +++ b/include/linux/percpu.h >> @@ -14,7 +14,11 @@ >>     /* enough to cover all DEFINE_PER_CPUs in modules */ >>   #ifdef CONFIG_MODULES >> +#ifdef X86_VSMP >> +#define PERCPU_MODULE_RESERVE        (1 << 16) >> +#else >>   #define PERCPU_MODULE_RESERVE        (8 << 10) >> +#endif >>   #else >>   #define PERCPU_MODULE_RESERVE        0 >>   #endif >> > >