From patchwork Tue Feb 27 21:00:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Souza, Jose" X-Patchwork-Id: 207428 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2962062dyb; Tue, 27 Feb 2024 13:01:32 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX1o7YIO1Ucw/2kgS6fKIOMZpXYPuXMsJip9HXQxhZk9J+H+A4I68jGJ5i+8sLzbBRrBC+QTMhNVHPZiqW1g/y+sbk/mA== X-Google-Smtp-Source: AGHT+IFSnJg/jhDJ96p2RGComU1yGK9P/8An2/zOALwNEIEoOFrGhst4IdCfZnbir1AMWq/J+N/L X-Received: by 2002:a0c:aada:0:b0:68f:6013:7af7 with SMTP id g26-20020a0caada000000b0068f60137af7mr2819570qvb.57.1709067692405; Tue, 27 Feb 2024 13:01:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709067692; cv=pass; d=google.com; s=arc-20160816; b=qf1G82Iw+BhlVw7SCxyG+dbt2k8ys24iK+wTMTBQAb4g7jBkhv7B2m+2p3R2c1QFtz /opyLjPHOC6E5PmB7KKVrvhOSm0PW2y4lSyOp8n6M9Z4d6b6owuAwSBgbZvZ3US/hQAQ 1QVylYXhAWrY1TisrijjIyhgWgjmTnDyqOCBfTJjaYpDC1ZGJj12FPbxxNBgyrEwr2LV RFVpVwieuoBk9Lzc9fi29bXZEVaZD0msctb2ejg13flYigfEDx48jcLgAWkivB8lfc12 SgzKS0ufk+7REergOSYHRj4wPVYWk+yAsEc7d8sWkVsCljc6G6eN9L/lRvhR9S8UVYNA 3y/w== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=OFH0Wtp5DuaTg4RM1LzWzss6ual4/ImD5JXfiun9ReQ=; fh=/aA3ikCzdHUoND1NkELyjjOlZC31bXhfya5LgPc2Wj8=; b=vltCByXwcS/RhYn1yWleuZOyVPGfTsFgTBMpAxiNYMn6VDpMYoL0/5QNYBTJ2Bl1yr nf5GNW4Wg+SJ5Aod1+SyuCGBymWBhV1POTY+2THCkRWRLNFxWrFo+oPeLEU71t5X3RNf QjoH7h1h6Ny5EvBY6TBLjg323oo9K5m23VoJ3Zdu8EnyzT11kDXV6b1Gi6ZqeIcvyOdg R+sNQkZAl2Qbfe1enGdw2alGFCm1qZGehtdE7zMySVsaPBwKctgbrSW5N43k3a2RTFDM kp1vdvrQ5iWvXuqf41Eoy3xKmaDoqChjGMETy/F1Onuip/8hUj0scPuE11BOl3E06QIW kqIw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VEspGJRd; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-84008-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84008-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id o6-20020a0562140e4600b0068f4a9f8150si8336363qvc.376.2024.02.27.13.01.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 13:01:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84008-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VEspGJRd; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-84008-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84008-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E2DC61C25FC7 for ; Tue, 27 Feb 2024 21:01:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1258814F99C; Tue, 27 Feb 2024 21:00:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="VEspGJRd" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 7C6F914DFF6 for ; Tue, 27 Feb 2024 21:00:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709067621; cv=none; b=WW70G8QHdgTPDmS7v9HseX5n16SR4fXnLM1RUfmaUIyDC0OMX/kqCir5N+iug9dNUjftpyN/ABKoH359LadVKZ7Osw2KSI+aFZyWojrYcccFDvyZwKwVQEAl0JIlPDO6KMBh/KvzThZLFsLw0K7jDfpZ+bTkPmOyoUW1JVZ6oTY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709067621; c=relaxed/simple; bh=g5hSKz8PPuysfPZ2UMVY6d54ATC/Id6iUngulkNyu8w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=b5qs2QgJZpOY6RVcQDiOx6saHox4vCmfOnoxQXRhmGyTn54IKFC10mHgA3wIToYbcagIaB8MYn3DwYxI63dUuk6E12RMkXPjSfGT+jf+saAxsw4O+JzvhEttwRyMRSfUFKHAUowNWGpbxw7woujaysVo4/qVE3xprzSY3Tpf7tU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=VEspGJRd; arc=none smtp.client-ip=192.198.163.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709067620; x=1740603620; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=g5hSKz8PPuysfPZ2UMVY6d54ATC/Id6iUngulkNyu8w=; b=VEspGJRd7t8nQYINgeb6iZGx8NTPivmeK7KBTc6F/BZyA9WWSKrPr8fN F6HH0um1kj6wWlHtBar55BLkno2X7EfV3k3SPQe6nQ0BQh9L2X4DTFGsC T80VdzZTSDyhfPBHhp171ZeI88GZO4twNV5iPdeAiUXKui+rvP/2KJa/s jow8eObI2HmtCWrugfZZ9icnK2UoMMYanhAYgQFqL5Vzf//wVHoakZ/dd tmoQkhICypcpQGqOQuVlXa5/M51IVXubFQ+PyWSMyy/FZQsyEBJHwwV5m wdqxUOgm+M/xUD7rgr/cT89V6D0u/JTiTAIIj+sHPSpT84NPLMu7iCrw+ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10996"; a="14858445" X-IronPort-AV: E=Sophos;i="6.06,188,1705392000"; d="scan'208";a="14858445" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2024 13:00:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,188,1705392000"; d="scan'208";a="7150417" Received: from josouza-mobl2.bz.intel.com ([10.87.243.88]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2024 13:00:17 -0800 From: =?utf-8?q?Jos=C3=A9_Roberto_de_Souza?= To: linux-kernel@vger.kernel.org, intel-xe@lists.freedesktop.org Cc: Rodrigo Vivi , Mukesh Ojha , Johannes Berg , Jonathan Cavitt , =?utf-8?q?Jos=C3=A9_Roberto_de?= =?utf-8?q?_Souza?= Subject: [PATCH 2/4] devcoredump: Add dev_coredump_timeout_set() Date: Tue, 27 Feb 2024 13:00:06 -0800 Message-ID: <20240227210008.182904-2-jose.souza@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240227210008.182904-1-jose.souza@intel.com> References: <20240227210008.182904-1-jose.souza@intel.com> 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: 1792087364446078309 X-GMAIL-MSGID: 1792087364446078309 Add function to set a custom coredump timeout. Current 5-minute timeout may be too short for users to search and understand what needs to be done to capture coredump to report bugs. Cc: Rodrigo Vivi Cc: Mukesh Ojha Cc: Johannes Berg Cc: Jonathan Cavitt Signed-off-by: José Roberto de Souza --- drivers/base/devcoredump.c | 23 +++++++++++++++++++++++ include/linux/devcoredump.h | 6 ++++++ 2 files changed, 29 insertions(+) diff --git a/drivers/base/devcoredump.c b/drivers/base/devcoredump.c index e96427411b87c..2857ceb3eb3aa 100644 --- a/drivers/base/devcoredump.c +++ b/drivers/base/devcoredump.c @@ -326,6 +326,29 @@ void dev_coredump_put(struct device *dev) } EXPORT_SYMBOL_GPL(dev_coredump_put); +/** + * dev_coredump_timeout_set - set coredump timeout + * @dev: the struct device for the crashed device + * @secs_timeout: new timeout in seconds + * + * If giving device has a coredump this sets a new timeout for coredump. + */ +void dev_coredump_timeout_set(struct device *dev, unsigned long secs_timeout) +{ + struct device *existing; + struct devcd_entry *devcd; + + existing = class_find_device(&devcd_class, NULL, dev, + devcd_match_failing); + if (!existing) + return; + + devcd = dev_to_devcd(existing); + mod_delayed_work(system_wq, &devcd->del_wk, HZ * secs_timeout); + put_device(existing); +} +EXPORT_SYMBOL_GPL(dev_coredump_timeout_set); + /** * dev_coredumpm - create device coredump with read/free methods * @dev: the struct device for the crashed device diff --git a/include/linux/devcoredump.h b/include/linux/devcoredump.h index c8f7eb6cc1915..70fe72a5c6d36 100644 --- a/include/linux/devcoredump.h +++ b/include/linux/devcoredump.h @@ -65,6 +65,7 @@ void dev_coredumpsg(struct device *dev, struct scatterlist *table, size_t datalen, gfp_t gfp); void dev_coredump_put(struct device *dev); +void dev_coredump_timeout_set(struct device *dev, unsigned long secs_timeout); #else static inline void dev_coredumpv(struct device *dev, void *data, size_t datalen, gfp_t gfp) @@ -90,6 +91,11 @@ static inline void dev_coredumpsg(struct device *dev, struct scatterlist *table, static inline void dev_coredump_put(struct device *dev) { } + +static inline void dev_coredump_timeout_set(struct device *dev, + unsigned long secs_timeout) +{ +} #endif /* CONFIG_DEV_COREDUMP */ #endif /* __DEVCOREDUMP_H */