Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp168321ybm; Thu, 28 May 2020 19:27:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvFWv3NCbEIK8EqAxgJGVEPoZzqP2kI8YxRaKMxnNQOq/5f7YlZMfyp7P2S8cdgb33ZXGl X-Received: by 2002:a17:906:1857:: with SMTP id w23mr5839615eje.273.1590719221314; Thu, 28 May 2020 19:27:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590719221; cv=none; d=google.com; s=arc-20160816; b=flcrpYPXQhyhYh82gD0RGYft/+tIqC4ZB+1hrzhSI/qA/YhRwoTX05jW6tRBrEHH35 /Gr7jRufeHyRMvlv4MdCSun8L7svOc+5ojCFOkwT4BlsGlAQ1DzKdlrWbDDSrdT3JU4j HIo/KTuskQRteOQh8vFPDCGj7ybY/7TUwKGSUDlTaFb7l8ef8LA/1O23FojH1y090UFw iwboXksGp4QqIxnILXpu/ph0P1YJ/ClALBwiKuq9eoQ/QgNPa60h+NwkVHOKJRoSTOfc 4oFzoMOcXAo+LNvCHedVbMdvzoc/QETMa/MzSwkcuRdAaFB/uH9dp4BreHQ8Y9SNbPh9 hLWw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=prpJ6+JiLe0pKhW6bqUL3zVuHnx23j7SQnl1ycsvITQ=; b=ZEX5tErEYzM9juH0QYjPAO2prgUUjhlyyh4H/cSYq4vhxI/J6lF1Yy4lXscl8etrI/ r/wQ2d9cXJEsCgjpq80tZarfRWxM6lbNbMaX+HXcL0n/i0BSh7864UT2yios44I529YS gnPdpXmaphrb02x1d5dPZzRdxqUX7QgLEAqqDujdZyrRE67caK8sFlINXecNM058zxNY Uk8jAXbfw2gpahcgPsEFjlTWSdwJYgLh+8i1k+k9LqKzcyLwVXYxyAioeQQtTad7tN2o Zn72D5pyZEQrtrXztV1EAcKiOqJNEVcYAYAlRB3m5sQFmnGLGX4dHtKnPCxoBf/o9Zrt p9XQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v25si4411898edi.119.2020.05.28.19.26.34; Thu, 28 May 2020 19:27:01 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405144AbgE2CYv (ORCPT + 99 others); Thu, 28 May 2020 22:24:51 -0400 Received: from out30-42.freemail.mail.aliyun.com ([115.124.30.42]:41046 "EHLO out30-42.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404312AbgE2CYt (ORCPT ); Thu, 28 May 2020 22:24:49 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R141e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07488;MF=yun.wang@linux.alibaba.com;NM=1;PH=DS;RN=12;SR=0;TI=SMTPD_---0TzwUFZy_1590719085; Received: from testdeMacBook-Pro.local(mailfrom:yun.wang@linux.alibaba.com fp:SMTPD_---0TzwUFZy_1590719085) by smtp.aliyun-inc.com(127.0.0.1); Fri, 29 May 2020 10:24:46 +0800 Subject: Re: [RFC PATCH] samples:bpf: introduce task detector To: Andrii Nakryiko Cc: Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , John Fastabend , KP Singh , open list , "open list:BPF (Safe dynamic programs and tools)" , "open list:BPF (Safe dynamic programs and tools)" References: <6561a67d-6dac-0302-8590-5f46bb0205c2@linux.alibaba.com> <9a78329c-8bfe-2b83-b418-3de88e972c5a@linux.alibaba.com> From: =?UTF-8?B?546L6LSH?= Message-ID: <0c8ec8d5-22df-8380-1ebf-e7f124dbe801@linux.alibaba.com> Date: Fri, 29 May 2020 10:24:45 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/5/29 上午2:34, Andrii Nakryiko wrote: [snip] >>> >>> With CO-RE, it also will allow to compile this tool once and run it on >>> many different kernels without recompilation. Please do take a look >>> and submit a PR there, it will be a good addition to the toolkit (and >>> will force you write a bit of README explaining use of this tool as >>> well ;). >> >> Aha, I used to think bcc only support python and cpp :-P >> > > libbpf-tools don't use BCC at all, they are just co-located with BCC > and BCC tools in the same repository and are lightweight alternatives > to BCC-based tools. But it needs kernel with BTF built-in, which is > the only (temporary) downside. I see, thanks for the explain :-) We prefer libbpf since we feel it's more friendly for kernel folks to do develop, less suspects when meet any BUG, while BCC is a good way to package and distribute, glad to know that we can have them in one piece now. Regards, Michael Wang > >> I'll try to rework it and submit PR, I'm glad to know that you think >> this tool as a helpful one, we do solved some tough issue with it >> already. >> >>> >>> As for the code itself, I haven't gone through it much, but please >>> convert map definition syntax to BTF-defined one. The one you are >>> using is a legacy one. Thanks! >>> >>> [0] https://github.com/iovisor/bcc/tree/master/libbpf-tools >> >> Will check the example there :-) >> >> Regards, >> Michael Wang >> >>> >>>> samples/bpf/Makefile | 3 + >>>> samples/bpf/task_detector.h | 382 +++++++++++++++++++++++++++++++++++++++ >>>> samples/bpf/task_detector_kern.c | 329 +++++++++++++++++++++++++++++++++ >>>> samples/bpf/task_detector_user.c | 314 ++++++++++++++++++++++++++++++++ >>>> 4 files changed, 1028 insertions(+) >>>> create mode 100644 samples/bpf/task_detector.h >>>> create mode 100644 samples/bpf/task_detector_kern.c >>>> create mode 100644 samples/bpf/task_detector_user.c >>>> >>> >>> [...] >>>