Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp6245132pxb; Thu, 27 Jan 2022 09:24:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJwC0ifL1+uKUW0+eFUoG8w1vv2dJtOa/zrtiXkTwQWkSgoyQ/mF5RsQeKD9CewQr/DsrhYa X-Received: by 2002:a17:907:7d8f:: with SMTP id oz15mr3865648ejc.138.1643304288321; Thu, 27 Jan 2022 09:24:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643304288; cv=none; d=google.com; s=arc-20160816; b=gRO62ex2g3jwDGld5hn8hz/l+dtpLV5g9ZpGi9KFR1NUdsv+d3LzpKzwGVq4atWUdG swVaw/FIlbVzrXopzjLIil24or7e6/oQzgVg690d6NN6eOkGXjZLdx/NL7rNvIqSzU4l jl89KwXQaVRRK2dgRS2PDKTZW9X3X/vmLwIZRT2V/s5wnWAX7JMOZV4/wQlmCvGnGJfN Q6svabUh9TKG1QFiQcyCHz69o9JmPvR8VrDRUUS/1CecNcVTiBd4oqfOw0CdiVMp2sjf +EAFohvJ8nD66cCrq911LS12lAn2MPW5RoTiVfnumB8+dFg9YClviZ8eMdybCXg/IKpk ifeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=lAMLR34jNozPdnmP0r/qrkgc/xZXHX189n9STko6+vo=; b=Q1qt5QjCQSEtXpRPE9W0p3kONxdHy9DhM+S/kISYQYTRDDjaJZLQTZykb+nJDgcKxv lyb+YCzMFM6TMBfMQyrZniSLGUVZicZBTcmitsNkgnjeBChvxTwhaRAsN46+RS9QWOAy CkptnD6yf1VlyLJPyLEQOaaSXmdNxjG5pjAEYDCFO5JQgLz6zvG8MJ3Zg4+9cw5xasp1 8QAuwpP0cZCi70TiFA4rG6/hMDvmnUArTScU7fsTQFnWswpNtyDKcDneEJ1D9VyGDyIj ZwSVdleKpBq06AzY0xK/wY/hKhFAai2mPGVUUhBeICnt3+DwaSok/JOKJAFUb1lEDx0r WnIg== 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 go12si1559038ejc.450.2022.01.27.09.24.23; Thu, 27 Jan 2022 09:24:48 -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 S238870AbiA0KDX (ORCPT + 99 others); Thu, 27 Jan 2022 05:03:23 -0500 Received: from mail-ua1-f49.google.com ([209.85.222.49]:46919 "EHLO mail-ua1-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229956AbiA0KDW (ORCPT ); Thu, 27 Jan 2022 05:03:22 -0500 Received: by mail-ua1-f49.google.com with SMTP id c36so3653710uae.13; Thu, 27 Jan 2022 02:03:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lAMLR34jNozPdnmP0r/qrkgc/xZXHX189n9STko6+vo=; b=MbfagxMwL8aKgT7Ejq/quMCpzAFV4VOA+v2TpZE8NiCQq8WKheIgiJqHaWaWAXcmQR NJFm+9+Mafr8an+fNc8eyho072h2lXh1+Haiew4vurqz1De2CUY3A4N2IR9ZuMQcXGQb plre3FALOKVQ6FQjGqlK2SD7ercnE6jp77DXQQtuGhkM+rB5S/OUI8cYHTsRtcASNLTo G+6q/yQv8eei57Xo36JwPkj6huJefcshc0bHFUUOMRhEYY3Vdd6n30ATnnRirQtq9EBt 6F+/6GqUDxV6wJNKHUoHftRYm6uRxWAAaJMeYnnTZhSI0rlce4HAVwSCGE79qrNJJzza FlZg== X-Gm-Message-State: AOAM532V4Cb6UIOVQDofsfLJCGuKAuNX8lzgQ5f36m4bBN+aYPqqN5ID vlNGJs2uIKWGrPY7Md+Zmb239yn/GQPtLQ== X-Received: by 2002:ab0:3c48:: with SMTP id u8mr1415022uaw.120.1643277801395; Thu, 27 Jan 2022 02:03:21 -0800 (PST) Received: from mail-vk1-f179.google.com (mail-vk1-f179.google.com. [209.85.221.179]) by smtp.gmail.com with ESMTPSA id w7sm511879vsi.0.2022.01.27.02.03.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jan 2022 02:03:20 -0800 (PST) Received: by mail-vk1-f179.google.com with SMTP id w206so1481083vkd.10; Thu, 27 Jan 2022 02:03:20 -0800 (PST) X-Received: by 2002:a05:6122:c8f:: with SMTP id ba15mr1132842vkb.39.1643277799973; Thu, 27 Jan 2022 02:03:19 -0800 (PST) MIME-Version: 1.0 References: <20220120090918.2646626-1-atishp@rivosinc.com> <20220120090918.2646626-7-atishp@rivosinc.com> <1AA3005C-E9C8-4E4B-900D-DD48B37CEA41@jrtc27.com> In-Reply-To: From: Geert Uytterhoeven Date: Thu, 27 Jan 2022 11:03:08 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 6/6] RISC-V: Do not use cpumask data structure for hartid bitmap To: Atish Patra Cc: 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 https://lore.kernel.org/all/CAAhSdy2xTW0FkwvS2dExOb7q1dVruFfTP_Vh_jWju+yi7thCeA@mail.gmail.com/ Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds