Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp862011ybt; Fri, 26 Jun 2020 13:25:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2LdVaWqfADHm3gefkLTdMUv8JyGTSbg9D/SxlRL0Vhsl6iKfMnzdCiaMt4oBgrOfqRv5m X-Received: by 2002:a05:6402:3064:: with SMTP id bs4mr5317387edb.350.1593203111539; Fri, 26 Jun 2020 13:25:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593203111; cv=none; d=google.com; s=arc-20160816; b=sL07QAxLrjQ4pPpEJ5nPS/Yurgj0jMpJRn0phaFWbVqIYa3Ql4EpZI2apwE/8CAX0Q loxTR6gBVbdino9ZpxwNegIBN3hp9xbFgyqBqO5mYpQAxwQO40IDCo71iAGC68bTv3pi JZgP2GOlwcB9afPpuhrvFKPpNrQa+kG1yGZsu/Rt5mOra4E9XWmlztJlHW5qAuGVmJuI X3ZWQpErOFxkJRka0fCzsZ+v3IDo6AleZa0y0++2yUbvQfz3G4o4kihASWBMBObYE75W 9IjtOUDofkU7mmmhLlh9femDinM7PQPfUXJNh/0ZbtZzhSz9E4jOfsndOKqUAzuHf6zN g5jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=IkGkXGsVlF8YAtrTLJ08heYqji9HN61SREZdAPXTiXE=; b=GjnE1IOtRXCKYBDlVUv7sfou3A7YPEONfFjR1FIuAKfJYbr2IJR8p87b/DNKtQVdWS SscdwPMjQZf1O3CryMp0rM1wkfr1NLbpjhn8vaC946CoTw3gHMRZHxmsFa1TIA1C1ZLj xHsJdxj4e+c+MGwarTRjrBLPFcSotLdBxO4lif3FctlnQBDbYLsFxiw+bzCCeYtZRJNo PngKQmRkMWLRDW72/nrdrcdmo+k1BICURHKaAJgtRPSDIn2STggdXkA7uKvC9cDwDj2v 4bUfN+oCYFfjEG47NP3m20krGVUInYCxy0NY9IQTp4uokhNzSyEJKXNo9GORRh0rwwjw Qozw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FtoaCFxd; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dm4si12893177edb.143.2020.06.26.13.24.48; Fri, 26 Jun 2020 13:25:11 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FtoaCFxd; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726036AbgFZUWR (ORCPT + 99 others); Fri, 26 Jun 2020 16:22:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725780AbgFZUWQ (ORCPT ); Fri, 26 Jun 2020 16:22:16 -0400 Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14EF4C03E979; Fri, 26 Jun 2020 13:22:16 -0700 (PDT) Received: by mail-qk1-x743.google.com with SMTP id l6so9980662qkc.6; Fri, 26 Jun 2020 13:22:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IkGkXGsVlF8YAtrTLJ08heYqji9HN61SREZdAPXTiXE=; b=FtoaCFxdg1PumOIK43C7AwM+BpIBEA5FWkWQvOc3fxJP+xk82Eav5/+pf0l+uJGfD7 ZZw3WvymAWU8jbz9VYMNojwTfLIKYyFvIOBEPTYcS8ivAViaynNzC8SxeMHOeBa/UoEe WjDhmu/d6glt7zSHXUNY+xUIXZ57TO4fQnORefboy+47OLF+6AuGN2Db/nL/1jO1mr8L 1gV+tL1AibaUoqif5pOxQgf5pZEfoqRV4lr2EOWFhKyPh+9q3sEycWju8yPrzJ24UVaL hVJLJJsCsOLPfp/73DaZLh4OF5gb3sQV3ALC5RavpmDYqBDkVNm5syIeI4gzi0+pFF9i VycA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IkGkXGsVlF8YAtrTLJ08heYqji9HN61SREZdAPXTiXE=; b=FXHcKnGBk+iH5+6ew5QKUg/bClPGMhFcNzQlIcM67K1SRbmT8HYpwbzzN36ZGCQXUS OjUbNTWuiGyrD+XqMpHmnknQ4Gqd10bFwT9lnX9GVgB+iOo6jj91h/OGe1L7FTFydZnX RSgVvJJB4WW6AX4TR0n+hrV17W9UxxAUPeCFgMtRxOimVfn5jZsXYEB2hgbA6dTh1VEF i93Wvfkh9I8nxr302obVsjXuM7SD1shpQVaZgiF2WwmXkCrjtUEUFxksTS9Zuqggkiqe 3davYDgU+0UzyP1iLyb14l5Y1aLuvPIdqDvZ1BZlaaai6Q3nl8TzMMrwKPlR+XpKDroR RBfA== X-Gm-Message-State: AOAM530reoYDhz/D4jWx33uQ/uxw9IRW4JXqitdtOqyb11g+CqhsMNO8 U9FmfAJuCczHzkhME+6j5qvOJpjJ6WGtUHkncYg= X-Received: by 2002:a05:620a:2409:: with SMTP id d9mr4702549qkn.36.1593202935341; Fri, 26 Jun 2020 13:22:15 -0700 (PDT) MIME-Version: 1.0 References: <20200626001332.1554603-1-songliubraving@fb.com> <20200626001332.1554603-3-songliubraving@fb.com> In-Reply-To: From: Andrii Nakryiko Date: Fri, 26 Jun 2020 13:22:03 -0700 Message-ID: Subject: Re: [PATCH v2 bpf-next 2/4] bpf: introduce helper bpf_get_task_stak() To: Song Liu Cc: bpf , Networking , open list , Peter Ziljstra , Alexei Starovoitov , Daniel Borkmann , Kernel Team , john fastabend , KP Singh Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 26, 2020 at 1:17 PM Andrii Nakryiko wrote: > > On Thu, Jun 25, 2020 at 5:14 PM Song Liu wrote: > > > > Introduce helper bpf_get_task_stack(), which dumps stack trace of given > > task. This is different to bpf_get_stack(), which gets stack track of > > current task. One potential use case of bpf_get_task_stack() is to call > > it from bpf_iter__task and dump all /proc//stack to a seq_file. > > > > bpf_get_task_stack() uses stack_trace_save_tsk() instead of > > get_perf_callchain() for kernel stack. The benefit of this choice is that > > stack_trace_save_tsk() doesn't require changes in arch/. The downside of > > using stack_trace_save_tsk() is that stack_trace_save_tsk() dumps the > > stack trace to unsigned long array. For 32-bit systems, we need to > > translate it to u64 array. > > > > Signed-off-by: Song Liu > > --- > > Looks great, I just think that there are cases where user doesn't > necessarily has valid task_struct pointer, just pid, so would be nice > to not artificially restrict such cases by having extra helper. > > Acked-by: Andrii Nakryiko oh, please also fix a typo in the subject, it will make grepping more frustrating [...]