Received: by 10.192.165.148 with SMTP id m20csp922612imm; Wed, 25 Apr 2018 09:40:36 -0700 (PDT) X-Google-Smtp-Source: AIpwx492icfbIsFC0/W30W1KkigOdKJBmiM9OJUsckw3wA2nAck6GzJEsjtYap25WKplfMQl61Nv X-Received: by 10.99.182.66 with SMTP id v2mr22770535pgt.158.1524674435922; Wed, 25 Apr 2018 09:40:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524674435; cv=none; d=google.com; s=arc-20160816; b=Pfer8dHDxTEU0ohGYXAtwBgRY5H8eV4PZ9sVaav0tWh9fRmNCWQJuBni7xHu23Dt/k Xa9dBidFJTnwuR0FA4Lv4An2eFZYLhVew7HWUbE7BNbc8wqYSCQsDchAdN6tQf4jC6y6 Axk+6Lu1LmYFsVpxXdvNpR6Du+IYfz5/UeEHH+WfYZiWjNuwsr6Scfn8WdrGlQWPsGhC hn7wr7EFsSuqJ92/ZjbziLjAlYCbLL5iOz1mXNkutFu5j9QxPwD1afYG/O0XxMKIUYH2 UxyCgJz9JYO6EQy2+SjMVJH14FdPHAPiaxR0DZJpGnLmpvkw7GebafptexUNFvuffv1q BRPA== 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=m1UJ9Bk2PAVH+Yaxn2dV+g+XU6oSedmywTC1nhcYL30=; b=jRleq5rqHgn+/GCDBC4HC9lxRyROrQEcx9gi9oD5B8/4/pSsVQkZqio0N9nfBNP077 0worN2TW4PWCrw7NCH9Ejr3DEbKRz2OhpiS/l2b2Ve3zCw0u0t6usvx4+NpuZZREgVr3 FsmcqEpwIrx0hUL++MnUkZZh9F0VRGnBUFbTJItkJFMbK5b3MYKarkeCaFxo0+XlRDtR Q3su9jjCqmlimk3W0xEzG3eyGwVUaNnmkhHTg/QP9L3rBAFgOqxG1jwYEBpxXvpUzHDO GpSZ3JasXXpiqu/EObUxDcwepHt6qIn3GL+flExZIaoLYnDkb8oK7ja46JTV/+yNehjd pjMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=cjPw+Po8; 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 g3si13977746pgr.635.2018.04.25.09.40.21; Wed, 25 Apr 2018 09:40:35 -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=cjPw+Po8; 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 S1755189AbeDYQjL (ORCPT + 99 others); Wed, 25 Apr 2018 12:39:11 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:38348 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754654AbeDYQjG (ORCPT ); Wed, 25 Apr 2018 12:39:06 -0400 Received: by mail-pf0-f194.google.com with SMTP id o76so10981434pfi.5 for ; Wed, 25 Apr 2018 09:39:06 -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=m1UJ9Bk2PAVH+Yaxn2dV+g+XU6oSedmywTC1nhcYL30=; b=cjPw+Po8U623bK6SsxEfqsTzKTIwx7mV7JNLyNZ0PpUyS8+z9kqFKW/N9Vf2Spbdvl k3szOFDa9dPVXuPBCJmXZzZbl4ML2WIg2+2EJrvFsAtHuenpVFZ8Fn7VhfKD9t7jz4Ep tuoB6Y24EeIJQbf8lbKLOKOVaYQVX/5qlYlLXyGoV+S5SU+ahb11Ty6hr5YB3YVNzMp0 AFGs2C0D/fGpYMs/qvWmL2XBMw4jO7DdcwIhpcmQig/DGU6FDqq2xSljsytdWICWbzl1 BNcXjWEa6TbzHcSlUuSfyigcrT0WcFSY//W0ZsjEFr48CeGGExiPTvCG0a2f2UphUFO3 +fvg== 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=m1UJ9Bk2PAVH+Yaxn2dV+g+XU6oSedmywTC1nhcYL30=; b=EnFxcDREbXRkas90Ga7QJ441d9V4Zul6gwP8/526ygipckenuUqneUCWMkqJZdqOsa zHAA4DInJ897IoVbS+AlYKztdf7vqikrp676TuHmc6dXf2RpSe2/3iP2Iu2+5KJpmze/ ZdpUuDc7iO2sEU+Pg3+/2ezgp6w0EsaigNBYwSoryMEoYtxDOaaK+ugrK5AKdDRI2uRq DUWLLIxuvWpas7VMgzg/Ap+RzoJX0cmqK2Awd6+i0CFBW4iuEg58gzqAzoUuDAd7Vjhv 1rtaHBSXd9/AwCOnhnl99JIr/iRh/xaOFdi/MBNBsnR2IJbFxwu/XoyT/Fwd+NLE8+oU 0WlQ== X-Gm-Message-State: ALQs6tAqDQ/3y0PtiZJzPONtVY8b9nPUSPDRXjbrX5JDjiSIHXnd3MDu VybkTWjAreqbqufSIcYRClj9fg== X-Received: by 2002:a17:902:a586:: with SMTP id az6-v6mr2923664plb.210.1524674345675; Wed, 25 Apr 2018 09:39:05 -0700 (PDT) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id u4sm29538906pfh.120.2018.04.25.09.39.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Apr 2018 09:39:04 -0700 (PDT) Date: Wed, 25 Apr 2018 09:39:04 -0700 (PDT) X-Google-Original-Date: Wed, 25 Apr 2018 09:34:44 PDT (-0700) Subject: Re: [PATCH v5 0/2] perf: riscv: Preliminary Perf Event Support on RISC-V In-Reply-To: <20180425031936.GA7303@andestech.com> CC: atish.patra@wdc.com, sols@sifive.com, nickhu@andestech.com, corbet@lwn.net, peterz@infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, acme@kernel.org, alexander.shishkin@linux.intel.com, mingo@redhat.com, albert@sifive.com, namhyung@kernel.org, linux-riscv@lists.infradead.org, jolsa@redhat.com, greentime@andestech.com From: Palmer Dabbelt To: alankao@andestech.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 20:19:36 PDT (-0700), alankao@andestech.com wrote: > Hi Atish, Palmer, > > On Tue, Apr 24, 2018 at 06:15:49PM -0700, Atish Patra 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 ;) >> > > Thanks for the test and discussion. It looks like am implementation issue from > Unleash, so ... is there anything I should fix and provide a further patch? You're welcome to fix BBL if you want, but that's unrelated to this patch set. I'm going to look over the code again as soon as I get a chance to, thanks for submitting the patches!