Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp743041pxb; Fri, 22 Apr 2022 10:13:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6xXvOegxsCklfM46VopuqQJaMBfDoONE8wcQjdqok/azepTFWmjpC2QPjN0cXwNdskcJU X-Received: by 2002:a05:6808:1182:b0:2d9:a01a:48b9 with SMTP id j2-20020a056808118200b002d9a01a48b9mr7261072oil.260.1650647601440; Fri, 22 Apr 2022 10:13:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650647601; cv=none; d=google.com; s=arc-20160816; b=i2+qeCQISTNeHg3mYJ02sOdYOtoBNd4l3T/uSsecB2KKuKFMnaETLSMYynZR/VfIcd ZYFhG5hmf74rTPmZTC4EuFtmFW4ipVaFgWQZxbfjJWeQbh0C7zSnbg0X2cN7WfurDtMP ng8bKsraTnaPDC2XTTqzG3XcojlCe4OvAJ72OmG9by82WPWwD58P8ocV3Nl+7t2VeqGm SVE6cXNxLxGSUatxtn72iWSE7F4RJNm/NHIRUVtbOx8ymZAxVcCKXZIVPbgfmsMgzIDg A3AZ8NtLfOED8lhhgrxN3fDeRsl/D6NRrLv8gjKlA5edzx+AHuQnsrIpPmgGlgs3mbDY riGw== 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=fiWLR17VDpLKbRo+43T1nudbmv7jbS4IG24R19EwcNM=; b=crraYUw0jFdfbqukQE1y+Jr6HVgHA60BklYMFgSuBLa0R6x7oOma+xPVUHv49bcgdS tztBwx1+3VthelavYn2Dfor4eAAjkr/mKfwW+IXM9Xx44rmpQW34eADhj+91mSZ/N7g+ ThD2h80zr0SOQ3+o1yuhprPWgm6gqQ1LG1B+A42xBEc7KNF0WbqJAS3CL6VC7wTU0U0q L3XePIllT/x8zxN6OlEiUPGQaeeqp8NikxojJeYURCISE1cOlIEoB6gd+IasUoAIk/Av 7Iy57BBxJLTQZYuvASU13eJn2dJNyPApn+xEdQZik9qj7OM4Zy5ZSP6dqw+rj49L15Ms K49g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id x13-20020a54400d000000b003227182bae8si4010889oie.90.2022.04.22.10.13.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 10:13:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 49FA19E9CA; Fri, 22 Apr 2022 10:12:36 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1449211AbiDVPFh (ORCPT + 99 others); Fri, 22 Apr 2022 11:05:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449198AbiDVPE2 (ORCPT ); Fri, 22 Apr 2022 11:04:28 -0400 Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BE3C5D647; Fri, 22 Apr 2022 08:01:28 -0700 (PDT) Received: by mail-lj1-f170.google.com with SMTP id w5so9968134lji.4; Fri, 22 Apr 2022 08:01:27 -0700 (PDT) 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=fiWLR17VDpLKbRo+43T1nudbmv7jbS4IG24R19EwcNM=; b=yMo/T1/vhPe4MnWmd37bbXE6AbI/jeWcL7bTy+LHTuq5eNUjFiQrvkgL+W6vbNsHdF vQ93e9ME/4pman1yQ/HS/ySp9FcLlwsXwvr/AaP5Wf9LUb0nA+vBVxhsBzmwB1W3HeAA CpH2pcjKl2+C6x4KTB4dZ+neEUS3eP61Ek3TOwby73/qqlYk5JZRRWl6QMZes64T3gxr tT2T2o2Athoriy2eWWt8wKfO8J3PEO+93ZSlRP1sDGFFGAjeOGY3eWypIm4enbExtIPb /D1l1eHgssnfswiY0JktHn04SB7i014x/iF5Ewupu7NGNGhUTXoNCEzqgNc5FKIQjWPt DuVQ== X-Gm-Message-State: AOAM533LSXNAYLEqTp8jDh5zKJhcN70H/9NP+YYYwsfi8lzSwuYszx1G D3Pq19CMqDnRFSG+Kw9hJ8JxpdwKcX1qY4xSfuQ= X-Received: by 2002:a2e:a793:0:b0:24e:e3bd:b3a8 with SMTP id c19-20020a2ea793000000b0024ee3bdb3a8mr2949005ljf.457.1650639686346; Fri, 22 Apr 2022 08:01:26 -0700 (PDT) MIME-Version: 1.0 References: <20220422053401.208207-1-namhyung@kernel.org> <35121321.B44TWeBT9p@milian-workstation> In-Reply-To: <35121321.B44TWeBT9p@milian-workstation> From: Namhyung Kim Date: Fri, 22 Apr 2022 08:01:15 -0700 Message-ID: Subject: Re: [RFC 0/4] perf record: Implement off-cpu profiling with BPF (v1) To: Milian Wolff Cc: Arnaldo Carvalho de Melo , Jiri Olsa , Ingo Molnar , Peter Zijlstra , LKML , Andi Kleen , Ian Rogers , Song Liu , Hao Luo , bpf , linux-perf-users , Blake Jones Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Milian, On Fri, Apr 22, 2022 at 3:21 AM Milian Wolff wrote: > > On Freitag, 22. April 2022 07:33:57 CEST Namhyung Kim wrote: > > Hello, > > > > This is the first version of off-cpu profiling support. Together with > > (PMU-based) cpu profiling, it can show holistic view of the performance > > characteristics of your application or system. > > Hey Namhyung, > > this is awesome news! In hotspot, I've long done off-cpu profiling manually by > looking at the time between --switch-events. The downside is that we also need > to track the sched:sched_switch event to get a call stack. But this approach > also works with dwarf based unwinding, and also includes kernel stacks. Thanks, I've also briefly thought about the switch event based off-cpu profiling as it doesn't require root. But collecting call stacks is hard and I'd like to do it in kernel/bpf to reduce the overhead. > > > With BPF, it can aggregate scheduling stats for interested tasks > > and/or states and convert the data into a form of perf sample records. > > I chose the bpf-output event which is a software event supposed to be > > consumed by BPF programs and renamed it as "offcpu-time". So it > > requires no change on the perf report side except for setting sample > > types of bpf-output event. > > > > Basically it collects userspace callstack for tasks as it's what users > > want mostly. Maybe we can add support for the kernel stacks but I'm > > afraid that it'd cause more overhead. So the offcpu-time event will > > always have callchains regardless of the command line option, and it > > enables the children mode in perf report by default. > > Has anything changed wrt perf/bpf and user applications not compiled with `- > fno-omit-frame-pointer`? I.e. does this new utility only work for specially > compiled applications, or do we also get backtraces for "normal" binaries that > we can install through package managers? I am not aware of such changes, it still needs a frame pointer to get backtraces. Thanks, Namhyung