Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp952898lqt; Fri, 7 Jun 2024 03:59:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUgpG/hl+yEO/dvWOKalmsYDyWhHqyCD+dTdE6SeVp3XzQPGDPG3p9wtkHRADOWB4fFkZK7OXCWAAXtLl0s0BtVuLlX6igyJrw/jZJwhQ== X-Google-Smtp-Source: AGHT+IHYtgQ4/uZDF0oOdUTTzVbcHqtbnnw2eIRKsMBnjswnsCx1XOjjGZgyxn2LUk6cCFYBY+tN X-Received: by 2002:a50:d4d8:0:b0:579:e6d1:d38b with SMTP id 4fb4d7f45d1cf-57c50886a45mr1060107a12.2.1717757990667; Fri, 07 Jun 2024 03:59:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717757990; cv=pass; d=google.com; s=arc-20160816; b=cJD6KV/RF8Jzabcao3RZx/aiz0uhA7gx5q+wsJE9F6e/SxghxoRWQ2xmuQ2/T6e7rb Llf9jx8engmfXZD+vW/hI3BWYNB5/pqPtCMN8fJ1BSw7ob8wzmjOOcSyZOAwbEB2q/5O fluJrFfpfzbLxxrPpm3MUIvPGVc/3UVnxt6EA0xzw6oME7Wlk35u452/c+mtHmpuPq7w T42jYjlPTFY8ulFDVcF6Qyi1fApLZbElrnXijtsbpDej58Qn7p4QERi9XMKd+B/aNvHQ b0LV404a0QdR5uv3N8X70u/hU7fClatoT6ltZGS/TZ46+GvvCervwgY2Bi//N1VFndVl MG3g== 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:message-id:date:subject:to:from :dkim-signature; bh=QB4oYmXLiJGYMvG/R01y9F7Lq08+rcE5hcMOxo0hir8=; fh=NaliBddKJRRfa/V6A30DamIvijmhnhuQcLyZQd5H8iw=; b=lFBUgyaOu8Gevd2sC4ZpgpcvoxUKGfLytLtApYFuNH1RxCYPgBocZ1+a2a1Vmk9Qd2 WD+rH60BtdshZaYBskWi7VXg/GPdRG+dbCmx6phiO3jrbxdwZ4nqNfpZYs+Zdx4iAwpD EMbfWfRurDCGOcJ3T+0NSLBfeaqpPlFXrdnUInfd5OrUPRP/FiT252oCKI/XQhnA2vmY cPFRnCUN6WInqG8Uzxrkx+a/XFxNagIP8R338EySC6lsoPhEjZ8j6SJ2dYFYxw61t9sI joCDg8QB2jQRmf6Tb2MSJaMQ68G8y8Hxz8cxD3wmoOR4ENm4bshqT2vJ0kzB8Zhdh8zp 4UVA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=FRhbUvIH; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-205857-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205857-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57aae28ddcdsi1642938a12.668.2024.06.07.03.59.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 03:59:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-205857-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=FRhbUvIH; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-205857-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205857-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.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 607841F25C95 for ; Fri, 7 Jun 2024 10:59:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7DFFF1862A9; Fri, 7 Jun 2024 10:59:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="FRhbUvIH" Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 5321E78C96 for ; Fri, 7 Jun 2024 10:59:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717757982; cv=none; b=ChJor2ZZ85sif5NxQF8iazYtvikWsLZNm1m/uStKolT3dUtDVLVizkIUdVeVXdTSa+xT0Q4LxiiQoN5N5m7VuOK068voUV78CD8FyDWNiimPvJ1heeC4h0fpAK/INHEj8B1Qyd/agHBkrmDL5U99FAnJESxCXj/W3EMCpMwHzoc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717757982; c=relaxed/simple; bh=13CC63O6WzMUiQHKNHxpWvs9vLgl5yeaMrCQ+TDxxWo=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=pVzEKLQTfkvDsS9k2qqyW3X2nmgxfbDKGPDvKojzu1xp9kBPPQpvcq8Wvv/pyRt/kLxoQOlkhoJTtq5CerS2uzhXTRBv/LGST51VbClbJ23pDkY+UBj5RkUL8poLtCRxjgv7vDBKw/+GZXeKYAHLhTgRutf5oQlvEFeFTWXm1zw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=FRhbUvIH; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 457At7l7004248; Fri, 7 Jun 2024 10:59:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=qcppdkim1; bh=QB4oYmXLiJGYMvG/R01y9F 7Lq08+rcE5hcMOxo0hir8=; b=FRhbUvIH6XuIWd01jNBMjidb36dWJeha3P8znj 28FAf/r+LBOQCc8ZqFx+ymV79MS7SsA60X9h8YkAM/jlawMepqlRIPGz37rvthxU hfS/cf7ZOP7fCG+qtXzrMVkno1PqRnA4nrnVHxCi/lsPysDjp2sOVA73Zvd3r7a2 pV9i41hA+QkbtfP5T8R2x5rtUB4LrAVyq+JVb+cgnNMC1zqzV/DBKw1Trdwnk9ba iPz9zjdzxbBYd8bI7GPAbZFWPxkmLDV0gY7YNymTUqadXbukVmsf4DlU7ufJuffp ZUNvt28xKv9Tf+HE2GPrsoNiNSmxVJZ5oa60OJftkW0TkS0Q== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3yjxxav7a8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Jun 2024 10:59:25 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 457AxOxj030932 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 7 Jun 2024 10:59:24 GMT Received: from hu-faiyazm-hyd.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Fri, 7 Jun 2024 03:59:21 -0700 From: Faiyaz Mohammed To: , , , , , , , Subject: [PATCH] kernel/reboot: enhance dmesg logging for system restart Date: Fri, 7 Jun 2024 16:29:06 +0530 Message-ID: <20240607105906.4192924-1-quic_faiyazm@quicinc.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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: QhTUjKT7tjTxqwjZZlo6vX-mwhMIPqVl X-Proofpoint-GUID: QhTUjKT7tjTxqwjZZlo6vX-mwhMIPqVl X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-07_05,2024-06-06_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=866 adultscore=0 priorityscore=1501 spamscore=0 malwarescore=0 mlxscore=0 bulkscore=0 phishscore=0 suspectscore=0 lowpriorityscore=0 clxscore=1011 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406070079 It is useful to add the PID and Comm information along with command info. Currently, when system reboot kernel logs don not print PID and Comm: reboot: Restarting system with command 'reboot,scheduled_reboot' reboot: Restarting system with command 'RescueParty' reboot: Restarting system with command 'bootloader' reboot: Restarting system with command 'recovery' reboot: Restarting system with command 'userrequested,recovery’ For Example after adding PID and Comm: reboot: PID: 1 Comm: init Restarting system with command 'shell' reboot: PID: 1 Comm: init Restarting system with command 'bootloader' Signed-off-by: Faiyaz Mohammed --- kernel/reboot.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/reboot.c b/kernel/reboot.c index f05dbde2c93f..91a4a1428eb9 100644 --- a/kernel/reboot.c +++ b/kernel/reboot.c @@ -274,14 +274,17 @@ static void do_kernel_restart_prepare(void) */ void kernel_restart(char *cmd) { + char comm[sizeof(current->comm)]; + + get_task_comm(comm, current); kernel_restart_prepare(cmd); do_kernel_restart_prepare(); migrate_to_reboot_cpu(); syscore_shutdown(); if (!cmd) - pr_emerg("Restarting system\n"); + pr_emerg("PID: %d Comm: %s Restarting system\n", current->pid, comm); else - pr_emerg("Restarting system with command '%s'\n", cmd); + pr_emerg("PID: %d Comm: %s Restarting system with command '%s'\n", current->pid, comm, cmd); kmsg_dump(KMSG_DUMP_SHUTDOWN); machine_restart(cmd); } -- 2.25.1