Received: by 10.192.165.148 with SMTP id m20csp899028imm; Wed, 25 Apr 2018 09:18:37 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+qxNAYJC3x0uQFXOTDTjDvUYM9KIMcjuky74VLeqS/+s5K3unjXJwBkreA8jQNstVngX3i X-Received: by 10.99.51.137 with SMTP id z131mr24313234pgz.386.1524673117645; Wed, 25 Apr 2018 09:18:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524673117; cv=none; d=google.com; s=arc-20160816; b=AxqYVEXwCvLc7PPt98/B9y1IcHPz9Hs3vEWZjqFQF+pE3C391hQIxpWHNxMvtcpOrA 0gQvhxC9phs+o9lia4W0UAc8hgVIulnBjR3KVeWGW2/teRN5Hlvj999BGTWQUonbO0S1 88/i+2ifmn8AsQv7GYaeVk2x8bH8YnvdY28yes4l1RlaNDZYhzcQzzT2uhvWG8HouBSE yq4G8wPfGhDyGOPjssuT2LuaaPvqqJxThZd6h0Mfi81J+9GTStAhkWJs22yPN7afScwL dGsLmBvd7ZJUjP/PO88VP60r/zPegAUyQaAj/v9+vbMullOdmXcVQW2AdOTrM8KcdDr8 AaBw== 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:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature :arc-authentication-results; bh=1w5Teq/vjzT7fHcpVLDI+L0Mu97HocoXlu/tuxJOw1Q=; b=pUUv+LuOFLMAxLLDH2yYJ2EHOzKUgFF3UdL0LD1DMeWhsd4RLinOvaC9a45XVnD22S BdmxJSXH0oHj6zmFCIlghrHU7a3y9mNv/Y4r4zcEEkSlAf2p3ksuExR9rrh9wFdhwrcC LhVRiePduVoL9co2G+XRgBrQaAvFJMB1N2XM3ubrokHsvpfLMR+9Ir6qy/nbTJCmiz6a 3bb+4Esk3goBFwaD7LIIMy9qrL4M1AapfMujrcGIQ45DAk17SYRHm309lq4rYGKrUahz 4wJzUL63F9nFwtvJ9hw97+c6jQoEy/otLwP04Agegjx1Fl5UJR11KSU3om7SEGR82RVT H5Sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=gVDIf5ES; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a5-v6si16051618pla.117.2018.04.25.09.18.23; Wed, 25 Apr 2018 09:18:37 -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=@sifive.com header.s=google header.b=gVDIf5ES; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755934AbeDYQRB (ORCPT + 99 others); Wed, 25 Apr 2018 12:17:01 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:43825 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755843AbeDYQQz (ORCPT ); Wed, 25 Apr 2018 12:16:55 -0400 Received: by mail-pg0-f68.google.com with SMTP id f132so13669369pgc.10 for ; Wed, 25 Apr 2018 09:16:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=1w5Teq/vjzT7fHcpVLDI+L0Mu97HocoXlu/tuxJOw1Q=; b=gVDIf5EScrEt3WsG7RhfVnRRrn9rE4l+3xwFzYjeOdKhRrx8lV93lLXdizdYfzFe/F tKBbnu/P1cmLuGz5nbMCxt2jbKRuADWxKye19cQoachBn0S+6jv4uTWpAxOVag3atorN SKSnzhu3Iy0mbeOUw2jEw4WPBCt9sM+n85/8dVmGe1YqZYr1jxEl3mVrlBnN3GjKZX+i apxntBVZ61hRLLhBXoBfIGkg8aHkiFUPBP+0njEwoOSLlhCbQzea2Yw+k0AFjO/U0ylF 3mBMdlZm4l5Dgo7is6XHqBrzNbBU9dGM5aNCYQIWVHrlPSGsw++FvfyVPZp67n7+/y7V SbWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=1w5Teq/vjzT7fHcpVLDI+L0Mu97HocoXlu/tuxJOw1Q=; b=gpTrhWbTiEiOSosfoKHcdSGIi5cvjWmwJKUrayOsFtmBPA8i7JbqW9CKddqeu5tsfT I71vCgMSe0owEvZTpyij5RQJNw243vtbOGYbmJesGURVg+QyjnmgLiA+kh9snYcZnt+3 L92x6RILnnCa8eA+3gk/D4OYScKsIsLrEPp0UAoU8NNiQ1VY7aiWEJbe62tRKZrXbMIJ +M+rgAedlCCPvSwnMi79GQ7LbWk1J5crOz9Zdgw+Er0QgK6Kfrquz7f5stJro4StqSen V7DkC0GhHlWrBlEPbEIINllbA9H6f8xbJn3RFQm7k5y2ac4Bjt444oC3O3Y+wv0sNJGu W3XQ== X-Gm-Message-State: ALQs6tCcg2VKZpCfYqITJVkz0Jrz1SnxrzmGK/MNxcMpM02LpEEEvjsW kzaao8qRHTlOpZopKLjb2mmxDA== X-Received: by 10.98.35.11 with SMTP id j11mr19066994pfj.177.1524673014917; Wed, 25 Apr 2018 09:16:54 -0700 (PDT) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id 142sm21234156pgg.86.2018.04.25.09.16.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Apr 2018 09:16:53 -0700 (PDT) Date: Wed, 25 Apr 2018 09:16:53 -0700 (PDT) X-Google-Original-Date: Wed, 25 Apr 2018 09:16:24 PDT (-0700) Subject: Re: [PATCH v5 0/2] perf: riscv: Preliminary Perf Event Support on RISC-V In-Reply-To: <6b211b64-5c17-2884-5b6a-6ff1d3287b16@wdc.com> CC: alankao@andestech.com, albert@sifive.com, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, sols@sifive.com, corbet@lwn.net, linux-riscv@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, greentime@andestech.com, nickhu@andestech.com From: Palmer Dabbelt To: atish.patra@wdc.com Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 24 Apr 2018 18:15:49 PDT (-0700), atish.patra@wdc.com wrote: > On 4/24/18 5:29 PM, Palmer Dabbelt wrote: >> On Tue, 24 Apr 2018 15:16:16 PDT (-0700), atish.patra@wdc.com wrote: >>> On 4/24/18 12:44 PM, Palmer Dabbelt wrote: >>>> On Tue, 24 Apr 2018 12:27:26 PDT (-0700), atish.patra@wdc.com wrote: >>>>> On 4/24/18 11:07 AM, Atish Patra wrote: >>>>>> On 4/19/18 4:28 PM, Alan Kao wrote: >>>>>> However, I got an rcu-stall for the test "47: Event times". >>>>>> # ./perf test -v 47 >>>>> Got it working. The test tries to attach the event to CPU0 which doesn't >>>>> exist in HighFive Unleashed. Changing it to cpu1 works. >>>>> >>>>> diff --git a/tools/perf/tests/event-times.c b/tools/perf/tests/event-times.c >>>>> index 1a2686f..eb11632f 100644 >>>>> --- a/tools/perf/tests/event-times.c >>>>> +++ b/tools/perf/tests/event-times.c >>>>> @@ -113,9 +113,9 @@ static int attach__cpu_disabled(struct perf_evlist >>>>> *evlist) >>>>> struct cpu_map *cpus; >>>>> int err; >>>>> >>>>> - pr_debug("attaching to CPU 0 as enabled\n"); >>>>> + pr_debug("attaching to CPU 1 as disabled\n"); >>>>> >>>>> - cpus = cpu_map__new("0"); >>>>> + cpus = cpu_map__new("1"); >>>>> if (cpus == NULL) { >>>>> pr_debug("failed to call cpu_map__new\n"); >>>>> return -1; >>>>> @@ -142,9 +142,9 @@ static int attach__cpu_enabled(struct perf_evlist >>>>> *evlist) >>>>> struct cpu_map *cpus; >>>>> int err; >>>>> >>>>> - pr_debug("attaching to CPU 0 as enabled\n"); >>>>> + pr_debug("attaching to CPU 1 as enabled\n"); >>>>> >>>>> - cpus = cpu_map__new("0"); >>>>> + cpus = cpu_map__new("1"); >>>>> if (cpus == NULL) { >>>>> pr_debug("failed to call cpu_map__new\n"); >>>>> return -1; >>>>> >>>>> >>>>> Palmer, >>>>> Would it be better to officially document it somewhere that CPU0 doesn't >>>>> exist in the HighFive Unleashed board ? >>>>> I fear that there will be other standard tests/code path that may fail >>>>> because of inherent assumption of cpu0 presence. >>>> >>>> I think the best way to fix this is to just have BBL (or whatever the >>>> bootloader is) renumber the CPUs so they're contiguous and begin with 0. >>> >>> Do you mean BBL will update the device tree that kernel eventually parse >>> and set the hart id? >>> Sounds good to me unless it acts as a big hack in future boot loaders. >> >> Right now the machine-mode and supervisor-mode hart IDs are logically separate: >> the bootloader just provides the hart ID as a register argument when starting >> the kernel. > > Yes. > > BBL already needs to enumerate the harts by looking through the >> device tree for various other reasons (at least to mask off the harts that >> Linux doesn't support), so it's not that much effort to just maintain a mapping >> from supervisor-mode hart IDs to machine-mode hart IDs. >> > > But Linux also parses the device tree to get hart ID in > riscv_of_processor_hart(). This is used to setup the possible/present > cpu map in setup_smp(). > > Thus, Linux also need to see a device tree with cpu0-3 instead of > cpu1-4. Otherwise, present cpu map will be incorrect. Isn't it ? > >> I have some patches floating around that do this, but appear to do it >> incorrectly enough that nothing boots so maybe I'm missing something that makes >> this complicated :). >> > > Just a wild guess: May be the because of the above reason ;) I was already changing all the IDs in the device tree, so that wasn't it.