Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2170747rbb; Tue, 27 Feb 2024 13:00:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVlcXVVq3g+N5z14qvvMIEC4rwVOhKepDSh6v7DNJdT0pl0jOeKKVHYe7zo/CEi9khaC3bUCGEfIpATbYh8PpI7Z4dYMnTFW+kBKMKZFg== X-Google-Smtp-Source: AGHT+IFLKW8bpxgUNmxHqvbuk0CGcnz/bCO4/6wC6mWMDZ5bytcTquo0/0JC+/Z+b0YhMvYFPjYv X-Received: by 2002:a17:907:1701:b0:a3d:83e2:bc9 with SMTP id le1-20020a170907170100b00a3d83e20bc9mr7631348ejc.50.1709067640102; Tue, 27 Feb 2024 13:00:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709067640; cv=pass; d=google.com; s=arc-20160816; b=lYZEud6c+U8EJAex+u8b12nyewwYLdx/ERiHz5/BWluwMGymQMC/LKt+erP1SCr3Re R5a1M2qH4Wmd2ckfk/a56g+8xDNBjFhh1xzpWFCjCgCOgGnRt+0qXIQraj8XcEmhDp55 j25e9i4dr1VJKKdndTHOcrlzKgMYjJGu66dk+QTufIOHWK+iHl46hURStBzeZp8Lki66 FM0f10QEVcRrMZUAP7h/1cHm7J18+j5NtRnlIVcX1J0fgMb4zdv9LKOKH1xSz6BlQ9m9 3/gHoBB8KNrOume71vhS6Db4tRldBmrI5FROv9V0XRdG2QV+4naaeSXhV5DajVDcTqVj oafg== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84008-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 y23-20020a1709063a9700b00a3d62fbc3e5si1026630ejd.255.2024.02.27.13.00.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 13:00:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84008-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=@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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84008-linux.lists.archive=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 am.mirrors.kernel.org (Postfix) with ESMTPS id D77381F24706 for ; Tue, 27 Feb 2024 21:00:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5085B14EFF8; Tue, 27 Feb 2024 21:00:22 +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=20Roberto=20de=20Souza?= 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=20Roberto=20de=20Souza?= 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 */ -- 2.44.0