Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5465951pxb; Wed, 26 Jan 2022 12:38:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJxylUn8iNEzqK6EAqd3lfcGpuk/Osd40MWhluVVJlAvxulT4fnGSPJQXOM3eUh/qer5cbTp X-Received: by 2002:a17:902:a5c1:: with SMTP id t1mr780693plq.106.1643229537386; Wed, 26 Jan 2022 12:38:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643229537; cv=none; d=google.com; s=arc-20160816; b=i3BNRKUxcC6IPMwmxxnIjMoDQXg7O9NdVkz2eWzQRGkq5WpDriEGy0HMdzxKf8+83J DAvuQwab8VP74bqyQ7KlQDGC0f9jFTBPQkQOzEVHekoKyt+0liYT4NCYTvhDvU5jMZxx AZnxCxe3EXFmG6mUjqnNZ9G7iOZFReLb58SgZlW7qjeHLz4HF2Rqe1MdO68J/PYBYNTj Iowlm8MIzNU74r1L5otf9L/KosmgDoANbkDYj4RMNhFhamY5B/XRvpnrN0pMJqAe8wkG lqBAP4bUsQgLUhlsddb/udDqjKOylK7WuOHjT2GAoezfrh1eBmKjIQ1oDAKqPYGLcbxN tM+w== 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=WmTPz9PmKhTaX5wyRQ+ebsEt337fwh+gbpdxl24qCZk=; b=SsDlmnJt30vQ8u7vOMSi/6nE1ZxwYSzEQbhEenAIlEpjAde3TroiEVWuzbHQnhfBT3 /L6dLh6DJSmrji2Q4QH8MTEYkpdG1EWBHyii5Q48OHvGz63QZiD4wSqOF4Ou8sW3xnz+ 9A3RIwqTAKa6pANY6TYgn2rSuMk6osOGkYJjSnZWGbDU0LFBYV7RvAYhT0CZmhaieuLE 8sYbGOfE5aB2sh+pbbYpIHJ6nLJyaIKVxm8sWn4ww73A9aIMPGRTBD1EuVAuba2FShQH 2vTAbrHfh9GKksmRCFZ4qORqRyx7UhgM854GLuPT27bMRNaSa7aIYhOCF3BzowYpjMBC noXw== 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 o4si301949pfu.251.2022.01.26.12.38.45; Wed, 26 Jan 2022 12:38:57 -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 S238784AbiAZJKc (ORCPT + 99 others); Wed, 26 Jan 2022 04:10:32 -0500 Received: from mail-vk1-f179.google.com ([209.85.221.179]:45670 "EHLO mail-vk1-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230425AbiAZJKb (ORCPT ); Wed, 26 Jan 2022 04:10:31 -0500 Received: by mail-vk1-f179.google.com with SMTP id w5so13943647vke.12; Wed, 26 Jan 2022 01:10:30 -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=WmTPz9PmKhTaX5wyRQ+ebsEt337fwh+gbpdxl24qCZk=; b=WmDWUQei11K4/7cwiar6+FUOlb6WTQ28QyOxLMvcdeTdc0QhJlIKn0gNKXXOefzv8P igexK/5T5u4dYYc6vLqt208wExX/rIeEjFplIYMANzdgyFJo0igs2wevu3iGCUsC3wfu E+y8CXk0I1c8+uJfbU7Q5QenGYVP8EpIxwWhPkc/yhbQyS0yz3sIFIj7hh7xjPOLwCzn wL60Xct99nbHgTvrEpfMLhXrXw2BlU9cNPQ9cHmkwYiCwdpVPgrhxhlswRXjMNoWZT+i Bk9p708O6vFnoAv872zgEK8ZLb9yzZdeEWr4a6B0OkO1YoxWVXMfw/Di3Og0OveEzjG1 qC+Q== X-Gm-Message-State: AOAM533I2WJ0zZawYbIgkRwAYDZww7NEkBKrPRmEciuaAIMYvnWzPJ/n JbVD5iWIo7Y6Kkfis6I7LLYEUDjUBw14p+5x X-Received: by 2002:a1f:3183:: with SMTP id x125mr9393049vkx.28.1643188230397; Wed, 26 Jan 2022 01:10:30 -0800 (PST) Received: from mail-ua1-f43.google.com (mail-ua1-f43.google.com. [209.85.222.43]) by smtp.gmail.com with ESMTPSA id u184sm3753070vke.49.2022.01.26.01.10.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 26 Jan 2022 01:10:29 -0800 (PST) Received: by mail-ua1-f43.google.com with SMTP id n15so40656911uaq.5; Wed, 26 Jan 2022 01:10:29 -0800 (PST) X-Received: by 2002:a67:b009:: with SMTP id z9mr5917064vse.57.1643188229085; Wed, 26 Jan 2022 01:10:29 -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: Wed, 26 Jan 2022 10:10:17 +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 Wed, Jan 26, 2022 at 9:28 AM Geert Uytterhoeven wrote: > On Wed, Jan 26, 2022 at 3:21 AM Atish Patra wrote: > > On Tue, Jan 25, 2022 at 2:26 PM Jessica Clarke wrote: > > > On 20 Jan 2022, at 09:09, Atish Patra wrote: > > > > Currently, SBI APIs accept a hartmask that is generated from struct > > > > cpumask. Cpumask data structure can hold upto NR_CPUs value. Thus, it > > > > is not the correct data structure for hartids as it can be higher > > > > than NR_CPUs for platforms with sparse or discontguous hartids. > > > > > > > > Remove all association between hartid mask and struct cpumask. > > > > > > > > Reviewed-by: Anup Patel (For Linux RISC-V changes) > > > > Acked-by: Anup Patel (For KVM RISC-V changes) > > > > Signed-off-by: Atish Patra > > > I am yet to reproduce it on my end. > > @Geert Uytterhoeven: can you please try the below diff on your end. > > Unfortunately it doesn't fix the issue for me. > > /me debugging... Found it: after this commit, the SBI_EXT_RFENCE_REMOTE_FENCE_I and SBI_EXT_RFENCE_REMOTE_SFENCE_VMA ecalls are now called with hmask = 0x8000000000000001 and hbase = 1 instead of hmask = 3 and hbase = 0. cpuid 1 maps to hartid 0 cpuid 0 maps to hartid 1 __sbi_rfence_v02:364: cpuid 1 hartid 0 __sbi_rfence_v02:377: hartid 0 hbase 1 hmask |= 1UL << (hartid - hbase); oops __sbi_rfence_v02_call:303: SBI_EXT_RFENCE_REMOTE_FENCE_I hmask 8000000000000001 hbase 1 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