Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp6268211pxb; Thu, 27 Jan 2022 09:56:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJw8r/v9v/rGEyzJzWWt99YjB2Q7FFxAIhAqmy3tceBIFGmraXnnG3cxZxQhCQ+l7XtjfSWk X-Received: by 2002:a05:6402:34c5:: with SMTP id w5mr4780583edc.226.1643306198951; Thu, 27 Jan 2022 09:56:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643306198; cv=none; d=google.com; s=arc-20160816; b=FlNKyKGj+QCdMtIjVh+KJ84nW+Xu+tHsoUyFo97K3Df0y2XV6rMQHwGY2BGPI5GTTb vy79uplyg/g0yzEhtRVcLpq9i6FYoCxpbMS6g161UwLi4kYnURLRRoJxfQECNSVt1HaA QRHSArxkUgyQIA00+jp1oNaWexSFRFTGn7uWdNjKUIxw6Jf1x8n5NRPSdogOCWTB+8jd YS4x91lEt27gAl41F3FiPFCcY3+uEPxEaVQaRDQ8YoOHa3vEPuka5s6C7New0B6Jycam kkrhR8qd/jiNrmOtVNYIVeHqOHZzgbNnlVJqwiSyOkOhRgfLuJUmoqAsFrLJ1q3U1gW7 J7oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from; bh=HI47SysqmLVw9hjTtgFqtM2un3t5n+M/kCP2Lkal2C4=; b=0u1CKeySE/VveAD4ShMJSU08bpg+sw2YrhA/yIgSMPsSy7i4MHl+kVr+VE1CfZ4+fB 2vGwyeYeKwxnsYLsQWp9CEKiKc1kLdaz9Pp0qH1Rj0x9ojy3MAowZnGtVB26QjBHQ3EB Na2H05ObKKMBuoX36f7BV/pQw8h6enwroNZf+8GZYzRf0hc6tIFjN4uUOIpf09PWOIH7 2v0uFYtiH1xuMHae76UhJlg0npKBJ9Nd6m/C6TKijxsYVu7Ah4M9nKsA+GPbmI1O/TwT Aoqh558dMVNz+6YxJfGzS3ZSRsXIYQuv3QEO0Jm67qfe0frHXT835KKNL+zodoUp9NVD BgWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sg41si1760685ejc.396.2022.01.27.09.56.13; Thu, 27 Jan 2022 09:56:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238979AbiA0KRb (ORCPT + 99 others); Thu, 27 Jan 2022 05:17:31 -0500 Received: from mail-out.m-online.net ([212.18.0.9]:48350 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235212AbiA0KRa (ORCPT ); Thu, 27 Jan 2022 05:17:30 -0500 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4JkxNL2R2pz1qxH2; Thu, 27 Jan 2022 11:17:22 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4JkxNL0XLCz1qqkB; Thu, 27 Jan 2022 11:17:22 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id tCDRGupXv8VQ; Thu, 27 Jan 2022 11:17:20 +0100 (CET) X-Auth-Info: RfvJpsA84gliY7mSCZZqmbcpg6JZ542+98dB4R6X6KFoCqBa8BX5Iua3nl62Uv9n Received: from igel.home (ppp-46-244-180-78.dynamic.mnet-online.de [46.244.180.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Thu, 27 Jan 2022 11:17:20 +0100 (CET) Received: by igel.home (Postfix, from userid 1000) id 8F3EA2C36D2; Thu, 27 Jan 2022 11:17:19 +0100 (CET) From: Andreas Schwab To: Geert Uytterhoeven Cc: Atish Patra , Jessica Clarke , Atish Patra , Linux Kernel Mailing List , Anup Patel , Albert Ou , Damien Le Moal , devicetree , Jisheng Zhang , Krzysztof Kozlowski , linux-riscv , Palmer Dabbelt , Paul Walmsley , Rob Herring Subject: Re: [PATCH v3 6/6] RISC-V: Do not use cpumask data structure for hartid bitmap References: <20220120090918.2646626-1-atishp@rivosinc.com> <20220120090918.2646626-7-atishp@rivosinc.com> <1AA3005C-E9C8-4E4B-900D-DD48B37CEA41@jrtc27.com> X-Yow: Isn't this my STOP?! Date: Thu, 27 Jan 2022 11:17:19 +0100 In-Reply-To: (Geert Uytterhoeven's message of "Thu, 27 Jan 2022 11:03:08 +0100") Message-ID: <87o83xtrdc.fsf@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Jan 27 2022, Geert Uytterhoeven wrote: > Hi Atish, > > On Thu, Jan 27, 2022 at 9:48 AM Geert Uytterhoeven wrote: >> On Thu, Jan 27, 2022 at 2:02 AM Atish Patra wrote: > > Ahh yes. hmask will be incorrect if the bootcpu(cpu 0) is a higher >> > hartid and it is trying to do a remote tlb flush/IPI >> > to lower the hartid. We should generate the hartid array before the loop. >> > >> > Can you try this diff ? It seems to work for me during multiple boot >> > cycle on the unleashed. >> > >> > You can find the patch here as well >> > https://github.com/atishp04/linux/commits/v5.17-rc1 >> >> Thanks, that fixes the issue for me. >> >> > --- a/arch/riscv/kernel/sbi.c >> > +++ b/arch/riscv/kernel/sbi.c > >> > @@ -345,13 +368,21 @@ static int __sbi_rfence_v02(int fid, const >> > struct cpumask *cpu_mask, >> > unsigned long arg4, unsigned long arg5) >> > { >> > unsigned long hartid, cpuid, hmask = 0, hbase = 0; >> > - int result; >> > + int result, index = 0, max_index = 0; >> > + unsigned long hartid_arr[NR_CPUS] = {0}; >> >> That's up to 256 bytes on the stack. And more if the maximum >> number of cores is increased. > > I.e. 4 KiB with the proposed increase to 256 CPUs, as mentioned in And those 4K need to be cleared each time the function is called, even if there is only a small number of cpus. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."