From patchwork Fri Feb 16 18:59:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 202330 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp726224dyb; Fri, 16 Feb 2024 11:06:15 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWhN7eeIMe9kiPfisYKKMA9Y2ox/QzXaoa3CQkpc0LifekAPB2BE/EwsQwo/NTw4hPU6T3yIbZUoK7vPhiY3BqVBnX1Dw== X-Google-Smtp-Source: AGHT+IE+3XnLybFSAIBJT1w4n6PTyvii/rmN4/zkybqggMNL5qRCrFIsAsQTgD77jTUwoErlp1aI X-Received: by 2002:a17:906:b898:b0:a3c:b7d5:22dd with SMTP id hb24-20020a170906b89800b00a3cb7d522ddmr4425475ejb.33.1708110374821; Fri, 16 Feb 2024 11:06:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708110374; cv=pass; d=google.com; s=arc-20160816; b=TpPvZFQYCqmbTC3uwsKnZN71pQ3R8q0nuNr1BRye7Bfa0Mf6hj19v3FphlJTErl7QL K3WUokm7RM6XeurjRolzQz7HezINiKA5zOc0ep+q99LkoUDbuzWqX9NV+2lxs6tbO97n GKpxLLXL7XlooGkiB9Zx6WJbZSiJ6Ag/K8j4HRt2CEO8LQ04m87Y5hXcosz34PBogER1 5ZmIeyGZavlGGv4ENJ9O1wzAHNqZ5uximF4Pp4cCg6UgwGhdIpiS6z+4V4ey91OeXG1T aHSRUMl5G2aYRwYcpGzHvzmoY9hyEOrIQY3DEd/5URHGZrM6sRz64iY/mlDX47jdcwW8 6QTA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:subject:cc:to:from :message-id:dkim-signature; bh=tnXXBc9Dk9zk7+Jx65RRNfhiBjugPoxHOwEKCCZqCk4=; fh=E+fjSkszu/3wtcymzZVrQck5XVLw8YkYnkF0SUB03B0=; b=FlzxppMOog97/mXaOwirX+7ulSTuV6WvYIsSK9kpTVitIBkIAhEsyhr/mHpYBx1Unm lMuvjs6Niog5+wGUao/UyrD53UMItatTG+HqcDkDkDYr/Aeq6TKUd2y9xpBajBl5BZVV XtrFjuVPXq2PLn4sPajLdr/L7WKbweepXOGF9xoJ6ziONGDi8YU+sRcW4v+Qtiy8TYXg Ln5Jz7VXKEN0ZirzM7gyw9R8L1uWaENnTr3JA41PoYdXYOQ5snN4J0UxEj1ubaiPSwo8 TrptTrC35OUrN+A50bobYpt9AECGSOIvuFmgWL2dbCyVni2SJzMf0KtisrUa0avSvq5K EZKw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=X8qngnjZ; arc=pass (i=1 spf=pass spfdomain=foxmail.com dkim=pass dkdomain=foxmail.com dmarc=pass fromdomain=foxmail.com); spf=pass (google.com: domain of linux-kernel+bounces-69227-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69227-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id o12-20020a17090608cc00b00a3d47b6aa71si169739eje.309.2024.02.16.11.06.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 11:06:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69227-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=X8qngnjZ; arc=pass (i=1 spf=pass spfdomain=foxmail.com dkim=pass dkdomain=foxmail.com dmarc=pass fromdomain=foxmail.com); spf=pass (google.com: domain of linux-kernel+bounces-69227-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69227-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 722C11F24827 for ; Fri, 16 Feb 2024 19:06:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7F779135A74; Fri, 16 Feb 2024 19:05:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=foxmail.com header.i=@foxmail.com header.b="X8qngnjZ" Received: from out203-205-221-236.mail.qq.com (out203-205-221-236.mail.qq.com [203.205.221.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6D0577F05 for ; Fri, 16 Feb 2024 19:05:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.205.221.236 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708110315; cv=none; b=EBKHK52G09MplzFka5wvgpy+a19hrT+UjMGtUcb3xce3HSAgaDmksU9CkILI//wP3GkS0SEWnjecmr6kOWU/LENkdFTB2hADtGCueUS/VKGnOPvVCJzmrWtAyO/VF1hBuqcqh92/qrQESnkbpZjhLMwyy4KNyPNuqQZ5uKV5R30= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708110315; c=relaxed/simple; bh=/CdKXp/M0IoZ35hcQEsRX21/nqp6k3E+d9PhAK6qvWM=; h=Message-ID:From:To:Cc:Subject:Date:MIME-Version; b=ubflAlgVbqw95H5lio7v4wIls8AJQ75EuW854R/izcHd9pXS+ehJ6ljXKUCYA1N8rvE9RDssU7tpOpHsJiEovDHaj3DMg3ohsh3UZCjcq3dXhG6AljppfOoNRo/xwOkS0gEM9M25fdUj+vfPB0fL8j+Y24A7uKPCMUDn4La8OXo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foxmail.com; spf=pass smtp.mailfrom=foxmail.com; dkim=pass (1024-bit key) header.d=foxmail.com header.i=@foxmail.com header.b=X8qngnjZ; arc=none smtp.client-ip=203.205.221.236 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foxmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foxmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1708110004; bh=tnXXBc9Dk9zk7+Jx65RRNfhiBjugPoxHOwEKCCZqCk4=; h=From:To:Cc:Subject:Date; b=X8qngnjZoBF5u5759OHcd3yi6Fg1ZPbr3Bx9B7zpGGg2hSjBrWK0GrqeKFmBHfowu 3NQACBS2DcLK705NkmOl8H+G3KdWF9LRnS9YvdgixEhMcNG/qQrBpd0lxOeCAXznyO ABSVucae6HftGVnh01ZOf7xz8NVOYVwNHx71P7+E= Received: from localhost.localdomain ([2409:8a60:2a63:47a0:34af:c8ac:3595:9c10]) by newxmesmtplogicsvrszb9-0.qq.com (NewEsmtp) with SMTP id 1BA45; Sat, 17 Feb 2024 03:00:00 +0800 X-QQ-mid: xmsmtpt1708110000txpy65wqo Message-ID: X-QQ-XMAILINFO: MdIvn1KXX/GIZaBqqhfY5ZNopXF6lFNATki9PxNHb1s0aqdSaXmHESGehNahBx fvLc2ueJ32JX/nmq2Cg78kEyZZS3UfagYnaTbOc22pjVzu7S+6wJ4FzisZYqIpM2+G5aZ9w+v7ce vfdUWGq1NQwWpwvdgvzA40qfEKJI0wy0HXt6XN/83B8O5YUCVcfNlGuEsW8Myt1nEwp6AHn/8aNm YyLI3xjbMZp9d+hpmAYz1SPJoQIYt3tDrAbJ5u74+dSHfFIekue6PFa5xugw7S+a2Y/+U9OvuF3w Zkdatxzvx6gtPTUvKAxMoll23mEw0oFcl4ZkiDvBV5VBa7XzqZ6E3xUmZloGFRu3Iq8Fsbxd1nSV 7zDaJtimT9jNeT3s8av6gUxOyGYlLN7wU7VxPYI71uzLTHfj4XimKeidRtYdl5zC6Z0n/ylOcJ4P 4zir20b1vpBFhVkrZk6Ssdn7AIE4X7We6gXHYJHAO4TIsxplPGgjoHpHNJ73lohIVpOG9czEAKdr iDtRF+P3/+sbW3ZureR3map+rifPyanpXeQwJJ7UAzizzPMuxlMqeyz8vnenZgUEYpQy/yjOlSpO qJyU12xSV43XBoUeS7aYpbp8yPtUWrnCHhMO4BmM8oqVIsNHCnrgIzp0rt3K0YbJKGNLKwSBP62e bgxMAvHsMgu0ztRcby1LqqRV5G9Yw2jmKANEuem4dvvsod7xLptaOQpbdFPcIiHvicMpQYf6HiiE 1n+BNShPiqnqgxYvMGdK0P9BTEBn3o+PKLm3+3A73OGmZzw/JZ+m3wgmycXBjSn326D1Ex1xStDK BU/VUbaoaAXDAWij2hE0naFkYgdVqISocd4aQRirlV+Oh7kgpEX7ENhZrmrblkI4t/hfPSZ5PT55 +n60dep3xxW7tPzv4PC37yxVdzmy7v5Yr2QuXGcZwMW5grd9Uuj+m58WKvutNTxwe7CjEZMQEhrQ tAgxi3U7ELfAXgpCEQbQEYJgtljn6P9Eb6ghQQTmCI429KRoP5Z7UKtwYho1/A0Ie17mgwcY54KR 3PQazk/g== X-QQ-XMRINFO: M/715EihBoGSf6IYSX1iLFg= From: wenyang.linux@foxmail.com To: Steven Rostedt , Masami Hiramatsu , Ingo Molnar Cc: Wen Yang , Oleg Nesterov , Mathieu Desnoyers , Mel Gorman , Peter Zijlstra , linux-kernel@vger.kernel.org Subject: [PATCH] coredump debugging: add a tracepoint to report the coredumping Date: Sat, 17 Feb 2024 02:59:47 +0800 X-OQ-MSGID: <20240216185947.352535-1-wenyang.linux@foxmail.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791083544326754860 X-GMAIL-MSGID: 1791083544326754860 From: Wen Yang Currently coredump_task_exit() takes some time to wait for the generation of the dump file. But if the user-space wants to receive a notification as soon as possible it maybe inconvenient. Add the new trace_sched_process_coredump() into coredump_task_exit(), this way a user-space monitor could easily wait for the exits and potentially make some preparations in advance. Signed-off-by: Wen Yang Cc: Oleg Nesterov Cc: Steven Rostedt Cc: Masami Hiramatsu Cc: Mathieu Desnoyers Cc: Ingo Molnar Cc: Mel Gorman Cc: Peter Zijlstra Cc: linux-kernel@vger.kernel.org --- include/trace/events/sched.h | 7 +++++++ kernel/exit.c | 1 + 2 files changed, 8 insertions(+) diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index dbb01b4b7451..ce7448065986 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h @@ -334,6 +334,13 @@ DEFINE_EVENT(sched_process_template, sched_process_exit, TP_PROTO(struct task_struct *p), TP_ARGS(p)); +/* + * Tracepoint for a task coredumping: + */ +DEFINE_EVENT(sched_process_template, sched_process_coredump, + TP_PROTO(struct task_struct *p), + TP_ARGS(p)); + /* * Tracepoint for waiting on task to unschedule: */ diff --git a/kernel/exit.c b/kernel/exit.c index 493647fd7c07..c11e12d73f4e 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -425,6 +425,7 @@ static void coredump_task_exit(struct task_struct *tsk) self.next = xchg(&core_state->dumper.next, &self); else self.task = NULL; + trace_sched_process_coredump(tsk); /* * Implies mb(), the result of xchg() must be visible * to core_state->dumper.