Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5788089pxb; Thu, 20 Jan 2022 04:44:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJxDBwKng0UXkPxuc13z/qD4DSfZXR0dLouKlgZcupspP1Y89raQ0csLIUBmEA/91HpyjV23 X-Received: by 2002:a17:903:246:b0:14a:26ae:4e86 with SMTP id j6-20020a170903024600b0014a26ae4e86mr39761096plh.59.1642682660216; Thu, 20 Jan 2022 04:44:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642682660; cv=none; d=google.com; s=arc-20160816; b=qBY4vVv9Am/G5SVXK0Rewd+c7A02uopreerjFOSrl49pfhays3MS0WaQzf93/sFgY5 4P0MFTL98RTDGpC32E4AcUg7QKYawLvtw5kGPe/gDSF62olP5xTVWoFircdEY6zmwnzn sa0PIhXhWbpIT9WgieUMHRYh/PKg+wj/6O9ovv0XKrJy0ybjQmf60iBML4q48Be1OWr4 XwJEh5u0t+jkO/IpJkDQslPoWoVKA333HeJwo9HiHqgMtALdJRzOEpjJtpYSpkN+1GAB r4cgGqtuQWKGom45CU3vtDZsEqrzgkzKg32bdTM28U84qXn4Lr0qg3lwSySS3KIuZIvN 3YBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=N0j/fQ4PflVYGPy/bLo8LyJo0AEkhVcyeqzgco+GTv8=; b=EggeRDAXmbw6/hlkc+EYToX99Z7SKXdDN/QCVoPUYmRX/7jy1jz2+JPjEBCjlj+v/h ktN+hWUBGWv0Fxs/9djvI3/kg4Tsoxg8UlUeZLDr6Sxs1fMziqfKDxjllCqvLOv4Bhd1 a6fNO9tO+c8d+8wY0nyzPcNHB2iabfkfCyDvD5bYpUr++eJ28KCy4JkYPcjc3y5khYGT pWsJVVrChuC1m8rRBam+/ZmGAiuwds9zvT34jLr1eaUkJoYWpUjvWXtCi9uz/yZdGeEd nwhxzRp3i08szBh+M+j/SwfvRT0WeQ4aVmBFhamKaCu+XLGQ8ow0X//Spx4eFdKuFnzV uuJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VF8b9qOt; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p1si9250208pjn.18.2022.01.20.04.44.08; Thu, 20 Jan 2022 04:44:20 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b=VF8b9qOt; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245327AbiAROZd (ORCPT + 99 others); Tue, 18 Jan 2022 09:25:33 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:52422 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233969AbiAROZb (ORCPT ); Tue, 18 Jan 2022 09:25:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642515930; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=N0j/fQ4PflVYGPy/bLo8LyJo0AEkhVcyeqzgco+GTv8=; b=VF8b9qOtBTViUT6+Slp36CzezAcdTXWL4olQown8KqKoP8K6N8gehy6fRjSepVu8G/p9JY WsKdYZUwgHcGXSGHu3hbfxteNvpimitwxLCtdGyGXYg4inQ8JfdeDozdqAtEWUfnUeoADL ltRSI3JuA1tBw8a50y2kPixXvjY2Lo8= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-570-JSLZuKm6OPmWEa-XEdhMsA-1; Tue, 18 Jan 2022 09:25:29 -0500 X-MC-Unique: JSLZuKm6OPmWEa-XEdhMsA-1 Received: by mail-ed1-f71.google.com with SMTP id cf15-20020a0564020b8f00b0040284b671c6so6031381edb.22 for ; Tue, 18 Jan 2022 06:25:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=N0j/fQ4PflVYGPy/bLo8LyJo0AEkhVcyeqzgco+GTv8=; b=2/p0K361DMZ7Ut9BAx0Ewl38aNjmGXapHBf9fjbOvUAXh3Ev2ZQPwhd1ct63wEEc4v LauAuyeQRw1YACSkg7a6batBqOWNP/L3OdjQ+pEF4abmV40vFSRrPHtyAKeTwk0c/opY MBEwDzjt0Oi9Q2DB/Hr8250FKUoXcXb4WbQyt5Z27o4BBUNpXu6tuYu45KvL4NEW/CWd qyzvuJf4Ul9Dk1Z8Qh0hieccMpBwHhnzd2FlnD9yWsKhchj2xFZw50qsjlrO5DSGiiD5 JW29ep7EI7e4voJ0+8n2bxcUjPOWwRxsfE4+M45V3AZTCeczysMGAqPyVW05tYl3AfNB SPOA== X-Gm-Message-State: AOAM533INEhh8AyNx0nYsHF8XWjx7VnHJojvfGfOt3MzQ8st76g73kAS G5QClCTes5fyV5JmG1StoMNTGGb232Kvi/fW9G9Yq+kQt4CgdYID1EXytQWAidsWu+62MHSyj3c CXcqz1+dVU26p3GKyUnCFRCvQ X-Received: by 2002:a17:907:6d22:: with SMTP id sa34mr19840876ejc.635.1642515928025; Tue, 18 Jan 2022 06:25:28 -0800 (PST) X-Received: by 2002:a17:907:6d22:: with SMTP id sa34mr19840848ejc.635.1642515927724; Tue, 18 Jan 2022 06:25:27 -0800 (PST) Received: from krava (nat-pool-brq-u.redhat.com. [213.175.37.12]) by smtp.gmail.com with ESMTPSA id cw6sm7205493edb.11.2022.01.18.06.25.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jan 2022 06:25:27 -0800 (PST) Date: Tue, 18 Jan 2022 15:25:25 +0100 From: Jiri Olsa To: Masami Hiramatsu Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , netdev@vger.kernel.org, bpf@vger.kernel.org, lkml , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Steven Rostedt , "Naveen N . Rao" , Anil S Keshavamurthy , "David S . Miller" Subject: Re: [RFC PATCH v2 0/8] fprobe: Introduce fprobe function entry/exit probe Message-ID: References: <164199616622.1247129.783024987490980883.stgit@devnote2> <20220115135219.64ef1cc6482d5de8a3bce9b0@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220115135219.64ef1cc6482d5de8a3bce9b0@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 15, 2022 at 01:52:19PM +0900, Masami Hiramatsu wrote: > On Thu, 13 Jan 2022 13:27:34 +0100 > Jiri Olsa wrote: > > > On Wed, Jan 12, 2022 at 05:01:15PM +0100, Jiri Olsa wrote: > > > On Wed, Jan 12, 2022 at 11:02:46PM +0900, Masami Hiramatsu wrote: > > > > Hi Jiri and Alexei, > > > > > > > > Here is the 2nd version of fprobe. This version uses the > > > > ftrace_set_filter_ips() for reducing the registering overhead. > > > > Note that this also drops per-probe point private data, which > > > > is not used anyway. > > > > > > > > This introduces the fprobe, the function entry/exit probe with > > > > multiple probe point support. This also introduces the rethook > > > > for hooking function return as same as kretprobe does. This > > > > > > nice, I was going through the multi-user-graph support > > > and was wondering that this might be a better way > > > > > > > abstraction will help us to generalize the fgraph tracer, > > > > because we can just switch it from rethook in fprobe, depending > > > > on the kernel configuration. > > > > > > > > The patch [1/8] and [7/8] are from your series[1]. Other libbpf > > > > patches will not be affected by this change. > > > > > > I'll try the bpf selftests on top of this > > > > I'm getting crash and stall when running bpf selftests, > > the fprobe sample module works fine, I'll check on that > > OK, I got a kernel stall. I missed to enable CONFIG_FPROBE. > I think vmtest.sh should support menuconfig option. > > #6 bind_perm:OK > #7 bloom_filter_map:OK > [ 107.282403] clocksource: timekeeping watchdog on CPU0: Marking clocksource 'tsc' as unstable because the skew is too large: > [ 107.283240] clocksource: 'hpet' wd_nsec: 496216090 wd_now: 7ddc7120 wd_last: 7ae746b7 mask: ffffffff > [ 107.284045] clocksource: 'tsc' cs_nsec: 495996979 cs_now: 31fdb69b39 cs_last: 31c2d29219 mask: ffffffffffffffff > [ 107.284926] clocksource: 'tsc' is current clocksource. > [ 107.285487] tsc: Marking TSC unstable due to clocksource watchdog > [ 107.285973] TSC found unstable after boot, most likely due to broken BIOS. Use 'tsc=unstable'. > [ 107.286616] sched_clock: Marking unstable (107240582544, 45390230)<-(107291410145, -5437339) > [ 107.290408] clocksource: Not enough CPUs to check clocksource 'tsc'. > [ 107.290879] clocksource: Switched to clocksource hpet > [ 604.210415] INFO: rcu_tasks detected stalls on tasks: > [ 604.210830] (____ptrval____): .. nvcsw: 86/86 holdout: 1 idle_cpu: -1/0 > [ 604.211314] task:test_progs state:R running task stack: 0 pid: 87 ppid: 85 flags:0x00004000 > [ 604.212058] Call Trace: > [ 604.212246] > [ 604.212452] __schedule+0x362/0xbb0 > [ 604.212723] ? preempt_schedule_notrace_thunk+0x16/0x18 > [ 604.213107] preempt_schedule_notrace+0x48/0x80 > [ 604.217403] ? asm_sysvec_apic_timer_interrupt+0x12/0x20 > [ 604.217790] ? ftrace_regs_call+0xd/0x52 > [ 604.218087] ? bpf_test_finish.isra.0+0x190/0x190 > [ 604.218461] ? bpf_fentry_test1+0x5/0x10 > [ 604.218750] ? trace_clock_x86_tsc+0x10/0x10 > [ 604.219064] ? __sys_bpf+0x8b1/0x2970 > [ 604.219337] ? lock_is_held_type+0xd7/0x130 > [ 604.219680] ? __x64_sys_bpf+0x1c/0x20 > [ 604.219957] ? do_syscall_64+0x35/0x80 > [ 604.220237] ? entry_SYSCALL_64_after_hwframe+0x44/0xae > [ 604.220653] > > Jiri, is that what you had seen? hi, sorry for late response I did not get any backtrace for the stall, debugging showed that the first probed function was called over and over for some reason as for the crash I used the small fix below do you have any newer version I could play with? jirka --- diff --git a/kernel/trace/fprobe.c b/kernel/trace/fprobe.c index 3333893e5217..883151275892 100644 --- a/kernel/trace/fprobe.c +++ b/kernel/trace/fprobe.c @@ -157,7 +157,8 @@ int unregister_fprobe(struct fprobe *fp) ret = unregister_ftrace_function(&fp->ftrace); if (!ret) { - rethook_free(fp->rethook); + if (fp->rethook) + rethook_free(fp->rethook); if (fp->syms) { kfree(fp->addrs); fp->addrs = NULL;