Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4845648rdb; Tue, 12 Dec 2023 10:49:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IG1LtkIKInYYsEFEbQLEoaSbi/U6x9DVqYyEAMf13FHbwKlW2ZtwxDbylOCkKB+jqShd8W3 X-Received: by 2002:a05:6a20:12c7:b0:190:3244:1798 with SMTP id v7-20020a056a2012c700b0019032441798mr4219072pzg.71.1702406978968; Tue, 12 Dec 2023 10:49:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702406978; cv=none; d=google.com; s=arc-20160816; b=MiWwN19s+pzD1ax1E9xg70F0LRnWbWeCkGyKX3XzFLRdx+CPmnxm8xJExtIEhJYjgx 4a6ieJDBGB1RXiLe08ZZtsutjktDVYgDaO/otoErA3VH05qFaxxKnv446AF3l+BER3ye W6GjdQTqVZYfV0PksmWDSn+JqUPtMTNSMgp2JaGoIhq04G3Yioo3Yxgaxzn644uW7hWH 30K1y6H+OKEgVeeSCMU9UcbGgWeViAOJMm8dMuxMRRmR9b/Ye/yO/co3YVLnEjvfP/8d tImcK1CiV51j3UeWQaHWjGv06Dns4z18n5U4Au1xCgM6anenynAWzIS699iFIRcqn4xI 9iZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=FAc8QKe0xHMKZC56bgyTzXWs7zYk5NJuhFUv4/QMfak=; fh=m9ptq+u/KegzVPwrgj0UFRhbRV9Att75pSvTgGSza3E=; b=OyYGGxQK/qFYHwnkGf3jT+Unf3jBF07Wbr5n940lAGSetNxX3LQuoL68Z6iqAj2ycu dlDw09zUeI0mW9bSyapP7g5xDeEuxFVpdTrah3/lKmBfZsJ4xG6JYolOamU9G1r4teHS gZ/lRufbhF82XOEgS19iqezhdk0YzcKwahgDsa6uFTiMQQcIqzh/ggDiaTxm6rBy46Wm /fbdP99UBjGiM9ucUYygAa5MHtsz4FvSIEU3PfXsgdRGLaOUO7sDMPg/TUgeFZZkrVb6 AgOALIhuLtfoPGuTR8WiKgCc9oKlALOIbDw4GGiUYBvN+Pz3wNiexFeMFdLcvUpDu8/U xrIA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id a17-20020a056a000c9100b006cdd1393a2fsi8348810pfv.96.2023.12.12.10.49.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 10:49:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 1919A804C6C8; Tue, 12 Dec 2023 10:49:35 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233022AbjLLStU convert rfc822-to-8bit (ORCPT + 99 others); Tue, 12 Dec 2023 13:49:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233052AbjLLStT (ORCPT ); Tue, 12 Dec 2023 13:49:19 -0500 Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7D4DEA; Tue, 12 Dec 2023 10:49:25 -0800 (PST) Received: by mail-pj1-f48.google.com with SMTP id 98e67ed59e1d1-2866af9d73bso4274508a91.3; Tue, 12 Dec 2023 10:49:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702406965; x=1703011765; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ieLFoul+mPd07DhlmLbEOA93lnztioXfkR7OG/Df+DA=; b=bAcc2eIzWeoo3OBxHov2eG3v9sOKkirmyvwy2vzWOyv25FliibRP0Q9VpbP6xQ0Sd2 6LVXnKeIHP47XKcJuF6O17MpXG3+yUxPiuxpigXHrN7MYQvMiXsDeXToo2aBJRwbwg6o HzFff+Sy/JEKk+Bn7txemmIyyKRrEyabunGs9gbJUo7iyW0078y8HT6dmNAaZZs2oJYG HvEJ6kAKfDL1FtrN5VpB9cSz7FsYhPQstkn+/nzx2Qred318rw+I7Ub8SyxfZmxZgO9d IGmNlPX65GRa2JCOQ7LhwLqDiqTKFuwQUfAW0RVRIJlu+OSK/vJumwqHjSahi8+4S4tq mOLg== X-Gm-Message-State: AOJu0YzYnKHWrs2pZZW2+OWGXstGxcFFdUD8R7/7gtpN6cKcuaP3hjZp t0J/0Ijbp0Z5RhCND0jONx9h/pz16Z2hQEKHvJs= X-Received: by 2002:a17:90b:1210:b0:28a:6137:149b with SMTP id gl16-20020a17090b121000b0028a6137149bmr2980031pjb.94.1702406965050; Tue, 12 Dec 2023 10:49:25 -0800 (PST) MIME-Version: 1.0 References: <20231208210855.407580-1-kan.liang@linux.intel.com> <07677ab2-c29b-499b-b473-f7535fb27a8c@linux.intel.com> In-Reply-To: From: Namhyung Kim Date: Tue, 12 Dec 2023 10:49:13 -0800 Message-ID: Subject: Re: [PATCH] perf top: Use evsel's cpus to replace user_requested_cpus To: Mark Rutland Cc: Ian Rogers , "Liang, Kan" , Arnaldo Carvalho de Melo , maz@kernel.org, marcan@marcan.st, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 12 Dec 2023 10:49:35 -0800 (PST) On Tue, Dec 12, 2023 at 10:31 AM Mark Rutland wrote: > > On Tue, Dec 12, 2023 at 10:00:16AM -0800, Ian Rogers wrote: > > On Tue, Dec 12, 2023 at 9:23 AM Namhyung Kim wrote: > > > > > > On Tue, Dec 12, 2023 at 7:56 AM Liang, Kan wrote: > > > > > > > > > > > > > > > > On 2023-12-11 4:13 p.m., Arnaldo Carvalho de Melo wrote: > > > > > Em Fri, Dec 08, 2023 at 01:08:55PM -0800, kan.liang@linux.intel.com escreveu: > > > > >> From: Kan Liang > > > > >> > > > > >> perf top errors out on a hybrid machine > > > > >> $perf top > > > > >> > > > > >> Error: > > > > >> The cycles:P event is not supported. > > > > >> > > > > >> The user_requested_cpus may contain CPUs that are invalid for a hybrid > > > > >> PMU. It causes perf_event_open to fail. > > > > > > > > > > ? > > > > > > > > > > All perf top expects is that the "cycles", the most basic one, be > > > > > collected, on all CPUs in the system. > > > > > > > > > > > > > Yes, but for hybrid there is no single "cycles" event which can cover > > > > all CPUs. > > > > > > Does that mean the kernel would reject the legacy "cycles" event > > > on hybrid CPUs? > > > > I believe not. When the extended type isn't set on legacy cycles we > > often have the CPU and from that can determine the PMU. The issue is > > with the -1 any CPU perf_event_open option. As I was told, the PMU the > > event is opened on in this case is the first one registered in the > > kernel, on Intel hybrid this could be cpu_core or cpu_atom.. but IIRC > > it'll probably be cpu_core. On ARM ¯\_(ツ)_/¯. > > On ARM it'll be essentially the same as on x86: if you open an event with > type==PERF_EVENT_TYPE_HARDWARE (without the extended HW type pointing to a > specific PMU), and with cpu==-1, it'll go to an arbitrary CPU PMU, whichever > happens to be found by perf_init_event() when iterating over the 'pmus' list. > > If you open an event with type==PERF_EVENT_TYPE_HARDWARE and cpu!=-1, the event > will opened on the appropriate CPU PMU, by virtue of being rejected by others > when perf_init_event() iterates over the 'pmus' list. Ok, that means "cycles" with cpu == -1 would not work well. I'm curious if it's possible to do some basic work at the event_init() like to preserve (common) resource and to do some other work at sched to config PMU on the current CPU. So that users can simply use "cycles" or "instructions" for their processes. Thanks, Namhyung