From patchwork Mon Mar 4 14:39:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Souza, Jose" X-Patchwork-Id: 209560 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp1462745dyc; Mon, 4 Mar 2024 06:39:41 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVhQV3IOZwPsMo1E+GkFXUey/k6Wp8NZHn4rAKf4f4n+reLt1KjLLgOgq6YjQ3TsK4+ENpXpEhsTUAONqrVIyRX3QNuog== X-Google-Smtp-Source: AGHT+IHtH4wclCkplXdL3jFElB52p5KPE+dbYCwjra4HBQTWYNnpbCGRRTuyWkOVkhT61HeLFMoo X-Received: by 2002:a05:6a20:6703:b0:1a1:4fc0:a55e with SMTP id q3-20020a056a20670300b001a14fc0a55emr2033202pzh.55.1709563181441; Mon, 04 Mar 2024 06:39:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709563181; cv=pass; d=google.com; s=arc-20160816; b=bCNupie2f4AGJQrTN0YE4q/GPpmGQiTECz8ofEEbIO6E6bkr6oUZrBcy8M7LtZ0NIx 4AZCVDZUM5434xwCNObX8X01iyZa+F64MpISYowJMLpiiGB1lA0xGWIEv5eWHUJFcMjP OyuKbX87bF7NQ9zL9h6K6HjhLdiV3Iu/hJOpCb17L9n0aOP5d+KNBDDpiNzOM+4C2Sba f+jdUO9cwfWMcncSn2LoSXwQaKaHPIZ3IMLXUWLgqheeyOPZk/8yPlI4S3t623GQy5mr lQFxpxTeF7MLoEQyCj5QTi2JeCtrihIVCeuUPjEc0pCyfC1teeNIDGVKEt+c7gqnOIsl /Tbg== 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:cc:to :from:dkim-signature; bh=cq8zRIuJWm+liYpoIrwTRtRNMZ8bKr8RBoakSIyGtFw=; fh=/aA3ikCzdHUoND1NkELyjjOlZC31bXhfya5LgPc2Wj8=; b=MUXSzcock7PK8qx72FrGCDCpcrtvAt/x5+i1LI5g9U4787q0o16yLQK1Oiqrliy2HH gQLzz+Vnx9En6VQ+U0hLeHwJSULBN/34mbcN50IbNkRyBh+aknwuR2tKmb2OqdePLqWh kpzskgxiBiFXKLFwirAdgnoP2Z3A76PB4oVha4nJfNzATRXYZrfSVyQIXrq7Pz6KBLif SeKwgCy9mJwhKZqOYvxiPxQzyZHNfYC1gfR/Xc2AlpD0fbVCaTQ6ARAdbroZ00ubvBG2 7GEqQYwaZ43jM8LUhGv/rJ1o6XzBPC9ay3MxweniZg6Q2bxzvfr3UKJP9JRlwnRN6POv D1Fw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ji2JuPx1; 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-90743-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90743-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id g17-20020a635211000000b005e428bef548si8531477pgb.649.2024.03.04.06.39.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 06:39:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90743-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ji2JuPx1; 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-90743-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90743-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 40131282559 for ; Mon, 4 Mar 2024 14:39:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 66EFB45C14; Mon, 4 Mar 2024 14:39:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ji2JuPx1" 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 BB56726AE7 for ; Mon, 4 Mar 2024 14:39:14 +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=1709563156; cv=none; b=oW0HLrNtsmTsNEJT8LSW/O4ey8wF54s/CPDyUFcsn4mGSB2cUKOQiAGZ0aHQT+VKdViwX6H/6EjhoplEHkoNchoL9MId0NU7BhfMo4w265hmf7reA9pqhbD+e5uPA+8vPp8m/0ctB0IysoHyGkeTUpvQRxesWfegFVDcFan9+Cs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709563156; c=relaxed/simple; bh=+MRf5Lm7FcBWGyRnw6HSAym7eF960AjwB9H891dwqBg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=MehSEmGdXip2iUcxFI2TL2f0EwcGzJdgGFHoKTBO29hqNMgWG62WOxp2T9Iot4gnvXqdpB1a4JBXjkafUxiTre6y1XoNmwDm6WvC/5jAFYkruzqMOHSyxmCgyYI2LViFHmE63A3MqlGuFesy1mIgsluQNkk08JFKrKRSVbf5lZQ= 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=ji2JuPx1; 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=1709563155; x=1741099155; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=+MRf5Lm7FcBWGyRnw6HSAym7eF960AjwB9H891dwqBg=; b=ji2JuPx1crnRorsQ4wb1oF1A0XRZ4uZTAZ1NhAewnrXt0fcSbYzNRTuN ne1yohJvL0YCCupG2KwxilBJ2TLdYVB6qiKpPM3ASAJ3Tzs3b/x02PfFJ l6ZGREZG3JLgNITeTC1UUECSdNFOT76XUu0SqT2Non18LXqSE2+UTnVBk 0idfv1HjE7a6vifswqqnR+KnmepCJw/Qu4ismswCTFJ+WwRZpcRZXa/p/ 8E6kHv0g5NuWvuNTjpAn5hlz966xM9nsFWCk4fGzWN4ypaRJig7pKKMBQ Dk93BIJqyycVqAZJ5Uk1q9NwxRxSLxXFlpuR9Qblkk5RvLqB8CSVJK7kE Q==; X-IronPort-AV: E=McAfee;i="6600,9927,11002"; a="15464629" X-IronPort-AV: E=Sophos;i="6.06,203,1705392000"; d="scan'208";a="15464629" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2024 06:39:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,203,1705392000"; d="scan'208";a="9162521" Received: from josouza-mobl2.bz.intel.com ([10.87.243.88]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2024 06:39:12 -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 v3 1/4] devcoredump: Add dev_coredump_put() Date: Mon, 4 Mar 2024 06:39:02 -0800 Message-ID: <20240304143905.52740-1-jose.souza@intel.com> X-Mailer: git-send-email 2.44.0 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: 1792606922456050078 X-GMAIL-MSGID: 1792606922456050078 It is useful for modules that do not want to keep coredump available after its unload. Otherwise, the coredump would only be removed after DEVCD_TIMEOUT seconds. v2: - dev_coredump_put() documentation updated (Mukesh) Cc: Rodrigo Vivi Cc: Mukesh Ojha Cc: Johannes Berg Cc: Jonathan Cavitt Acked-by: Jonathan Cavitt Signed-off-by: José Roberto de Souza --- drivers/base/devcoredump.c | 23 +++++++++++++++++++++++ include/linux/devcoredump.h | 5 +++++ 2 files changed, 28 insertions(+) diff --git a/drivers/base/devcoredump.c b/drivers/base/devcoredump.c index 7e2d1f0d903a6..82aeb09b3d1b5 100644 --- a/drivers/base/devcoredump.c +++ b/drivers/base/devcoredump.c @@ -304,6 +304,29 @@ static ssize_t devcd_read_from_sgtable(char *buffer, loff_t offset, offset); } +/** + * dev_coredump_put - remove device coredump + * @dev: the struct device for the crashed device + * + * dev_coredump_put() removes coredump, if exists, for a given device from + * the file system and free its associated data otherwise, does nothing. + * + * It is useful for modules that do not want to keep coredump + * available after its unload. + */ +void dev_coredump_put(struct device *dev) +{ + struct device *existing; + + existing = class_find_device(&devcd_class, NULL, dev, + devcd_match_failing); + if (existing) { + devcd_free(existing, NULL); + put_device(existing); + } +} +EXPORT_SYMBOL_GPL(dev_coredump_put); + /** * 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 c008169ed2c6f..c8f7eb6cc1915 100644 --- a/include/linux/devcoredump.h +++ b/include/linux/devcoredump.h @@ -63,6 +63,8 @@ void dev_coredumpm(struct device *dev, struct module *owner, void dev_coredumpsg(struct device *dev, struct scatterlist *table, size_t datalen, gfp_t gfp); + +void dev_coredump_put(struct device *dev); #else static inline void dev_coredumpv(struct device *dev, void *data, size_t datalen, gfp_t gfp) @@ -85,6 +87,9 @@ static inline void dev_coredumpsg(struct device *dev, struct scatterlist *table, { _devcd_free_sgtable(table); } +static inline void dev_coredump_put(struct device *dev) +{ +} #endif /* CONFIG_DEV_COREDUMP */ #endif /* __DEVCOREDUMP_H */ From patchwork Mon Mar 4 14:39:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Souza, Jose" X-Patchwork-Id: 209562 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp1463034dyc; Mon, 4 Mar 2024 06:40:19 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVmSr+JxPlqprYbtozbYEk2/l7oYk7yRYxR5fYIUOTDaQDrIC5dDRvVMs0v124W2COwhTLfnF72q8VCo5Aa3hTP2yPecg== X-Google-Smtp-Source: AGHT+IHq6sZCrY1QA4nijx4c9VBAVB4xc4wyLODDltuL+tmECfe3/Jkvjo7Y+anJn+WvuOnOn+rQ X-Received: by 2002:a17:90a:578e:b0:299:3035:aede with SMTP id g14-20020a17090a578e00b002993035aedemr5966611pji.44.1709563219623; Mon, 04 Mar 2024 06:40:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709563219; cv=pass; d=google.com; s=arc-20160816; b=W+p8Z0bJg5RXY+DJO6frBNT6qVQtw5lnv8npLCyq9X9+/CSMekAZwTSuCWzaipW/RB qd59jNaLyS9nPPfhM8WqyCyl/qIzIN1MTsIh2Qo2DqhXN+gaz+Eo0IByDxxcXuo26DR2 F4+IjCcFrIWLg+/Gm2vR0X94ARd2X+4h/tdAXDmPUoQr40TyoKPmmYxTfMLNoCr6PB+N UKbZrgIoUrw/QGppHb9IAbTHHLNu8PNcRWW5brlTEjlSymTEAq65rJqzTRsFRS68+3QW V0S4vIjVddLS1aN4jtoP/lfTAFEtxWb6tKP4GfLO1rltQjWMLYd+gp8ud9bBvXf3HnVU NTOw== 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=Dk393IN1jxoXMUA5gtF3S7SqJlqtfwTkt4nljwNJMmo=; fh=/aA3ikCzdHUoND1NkELyjjOlZC31bXhfya5LgPc2Wj8=; b=BTUkVkwvUfeJ1hhWdCG3V3QZUDndAJ9palOYYoxhIcZl3S+IioHu2smFyD//9vFLmo dKKy+068cyvcXWdLfVSrEKmEUvXN9nhZelWqTrS2W3yFgg03f+CfiTL11VQ4MjEgE45V b9DGepXoRA0yEqrpWoTr0+lGkcfF/JkOXmkrghnCvTSD33uxE00FHJEfYthGwC5qDS7M LzP1UsgMmU/hsWfUMzBuonFaf6UMOEx7jFBipwf4KtxlX+bG237T149t2lRgODwExzMU 0P1zsLwlV6rQ/s2E49aSF0LPqY5S/aXSbDDF7UbUIYiUvpwrR18AEWgDI1BVhOmmEXK1 27dQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gkfeS39F; 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-90744-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90744-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id il15-20020a17090b164f00b0029b43cce4d0si2790433pjb.183.2024.03.04.06.40.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 06:40:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90744-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gkfeS39F; 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-90744-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90744-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 6A55B28279F for ; Mon, 4 Mar 2024 14:40:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 42ADD482D0; Mon, 4 Mar 2024 14:39:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gkfeS39F" 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 AD5AF3CF6D for ; Mon, 4 Mar 2024 14:39:16 +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=1709563158; cv=none; b=Ie5c1f9rV8eqKkk0Ul1c/SqzweEFdK8DCWz7gbccqu9Sv/+sYPi1USAnVPn1w4GwOeFDowHjd8f0PMlBk1PtxhUDytnxxJZkCfcrNS7sgv9iQnTEQEdhZI63LX1ORi+euT4HfEgC12Fb4/RpRt5mHJTeWsRpdRlYs2jL9JGWJyk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709563158; c=relaxed/simple; bh=lmw9xOoiQDklyw261pt95/gZg8tQiKm6KXYJNlcrwdM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LsvgZwtOgr4KtY0ieywmjm2VhSExyT+/rt5Ltf8+SVD3cwBETtHJI2c2C2X6hBpLlZJUQvlb7gWDJrfGA/eAuwZLz4Q/lGwaKzPUmGFtAAjUshL/mlBeOKnRh7qA7g21p/UXfnIgna6BJa5NWBxQoULcpCyrP7ExH+reMXiRG0E= 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=gkfeS39F; 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=1709563157; x=1741099157; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lmw9xOoiQDklyw261pt95/gZg8tQiKm6KXYJNlcrwdM=; b=gkfeS39F5zxh5DqDu18NlhPENneflJhlt99UlcBIhB3oBj9W/ftb4vLA chg495AbLyG7RhmlyRrbwO0rOZqblNGusBf0HzWVDEyvqqIzcFTmAG56E Akkfx4u+R3E82XP7a8M5GSJdcSQRVNKTNL9RdzAhC1KUXvK+G5PEIYtyW PWnG4smusVGDDOOmI72VSPCq5i/Gyqj2Lghr2/4fj21FdmEmVFereHuFj wPuYOTmNsiogE2qYmW/iBjVoCzWrCuOf/60fQWxQtyw02K9Z00D9wjnQm P8ZVAgJ2ZvSS/RXYAQ4klpth1cdVCRr5plyMsgzQczQxkji8pXfhJ7tqT A==; X-IronPort-AV: E=McAfee;i="6600,9927,11002"; a="15464634" X-IronPort-AV: E=Sophos;i="6.06,203,1705392000"; d="scan'208";a="15464634" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2024 06:39:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,203,1705392000"; d="scan'208";a="9162540" Received: from josouza-mobl2.bz.intel.com ([10.87.243.88]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2024 06:39:14 -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 v3 2/4] devcoredump: Add dev_coredumpm_timeout() Date: Mon, 4 Mar 2024 06:39:03 -0800 Message-ID: <20240304143905.52740-2-jose.souza@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240304143905.52740-1-jose.souza@intel.com> References: <20240304143905.52740-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: 1792606962419407944 X-GMAIL-MSGID: 1792606962419407944 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. v2: - replace dev_coredump_timeout_set() by dev_coredumpm_timeout() (Mukesh) v3: - make dev_coredumpm() static inline (Johannes) Cc: Rodrigo Vivi Cc: Mukesh Ojha Cc: Johannes Berg Cc: Jonathan Cavitt Acked-by: Jonathan Cavitt Signed-off-by: José Roberto de Souza --- drivers/base/devcoredump.c | 23 ++++++++-------- include/linux/devcoredump.h | 54 ++++++++++++++++++++++++++++--------- 2 files changed, 54 insertions(+), 23 deletions(-) diff --git a/drivers/base/devcoredump.c b/drivers/base/devcoredump.c index 82aeb09b3d1b5..c795edad1b969 100644 --- a/drivers/base/devcoredump.c +++ b/drivers/base/devcoredump.c @@ -18,9 +18,6 @@ static struct class devcd_class; /* global disable flag, for security purposes */ static bool devcd_disabled; -/* if data isn't read by userspace after 5 minutes then delete it */ -#define DEVCD_TIMEOUT (HZ * 60 * 5) - struct devcd_entry { struct device devcd_dev; void *data; @@ -328,7 +325,8 @@ void dev_coredump_put(struct device *dev) EXPORT_SYMBOL_GPL(dev_coredump_put); /** - * dev_coredumpm - create device coredump with read/free methods + * dev_coredumpm_timeout - create device coredump with read/free methods with a + * custom timeout. * @dev: the struct device for the crashed device * @owner: the module that contains the read/free functions, use %THIS_MODULE * @data: data cookie for the @read/@free functions @@ -336,17 +334,20 @@ EXPORT_SYMBOL_GPL(dev_coredump_put); * @gfp: allocation flags * @read: function to read from the given buffer * @free: function to free the given buffer + * @timeout: time in jiffies to remove coredump * * Creates a new device coredump for the given device. If a previous one hasn't * been read yet, the new coredump is discarded. The data lifetime is determined * by the device coredump framework and when it is no longer needed the @free * function will be called to free the data. */ -void dev_coredumpm(struct device *dev, struct module *owner, - void *data, size_t datalen, gfp_t gfp, - ssize_t (*read)(char *buffer, loff_t offset, size_t count, - void *data, size_t datalen), - void (*free)(void *data)) +void dev_coredumpm_timeout(struct device *dev, struct module *owner, + void *data, size_t datalen, gfp_t gfp, + ssize_t (*read)(char *buffer, loff_t offset, + size_t count, void *data, + size_t datalen), + void (*free)(void *data), + unsigned long timeout) { static atomic_t devcd_count = ATOMIC_INIT(0); struct devcd_entry *devcd; @@ -403,7 +404,7 @@ void dev_coredumpm(struct device *dev, struct module *owner, dev_set_uevent_suppress(&devcd->devcd_dev, false); kobject_uevent(&devcd->devcd_dev.kobj, KOBJ_ADD); INIT_DELAYED_WORK(&devcd->del_wk, devcd_del); - schedule_delayed_work(&devcd->del_wk, DEVCD_TIMEOUT); + schedule_delayed_work(&devcd->del_wk, timeout); mutex_unlock(&devcd->mutex); return; put_device: @@ -414,7 +415,7 @@ void dev_coredumpm(struct device *dev, struct module *owner, free: free(data); } -EXPORT_SYMBOL_GPL(dev_coredumpm); +EXPORT_SYMBOL_GPL(dev_coredumpm_timeout); /** * dev_coredumpsg - create device coredump that uses scatterlist as data diff --git a/include/linux/devcoredump.h b/include/linux/devcoredump.h index c8f7eb6cc1915..56e606eb4640b 100644 --- a/include/linux/devcoredump.h +++ b/include/linux/devcoredump.h @@ -12,6 +12,9 @@ #include #include +/* if data isn't read by userspace after 5 minutes then delete it */ +#define DEVCOREDUMP_TIMEOUT (HZ * 60 * 5) + /* * _devcd_free_sgtable - free all the memory of the given scatterlist table * (i.e. both pages and scatterlist instances) @@ -50,16 +53,17 @@ static inline void _devcd_free_sgtable(struct scatterlist *table) kfree(delete_iter); } - #ifdef CONFIG_DEV_COREDUMP void dev_coredumpv(struct device *dev, void *data, size_t datalen, gfp_t gfp); -void dev_coredumpm(struct device *dev, struct module *owner, - void *data, size_t datalen, gfp_t gfp, - ssize_t (*read)(char *buffer, loff_t offset, size_t count, - void *data, size_t datalen), - void (*free)(void *data)); +void dev_coredumpm_timeout(struct device *dev, struct module *owner, + void *data, size_t datalen, gfp_t gfp, + ssize_t (*read)(char *buffer, loff_t offset, + size_t count, void *data, + size_t datalen), + void (*free)(void *data), + unsigned long timeout); void dev_coredumpsg(struct device *dev, struct scatterlist *table, size_t datalen, gfp_t gfp); @@ -72,12 +76,13 @@ static inline void dev_coredumpv(struct device *dev, void *data, vfree(data); } -static inline void -dev_coredumpm(struct device *dev, struct module *owner, - void *data, size_t datalen, gfp_t gfp, - ssize_t (*read)(char *buffer, loff_t offset, size_t count, - void *data, size_t datalen), - void (*free)(void *data)) +void dev_coredumpm_timeout(struct device *dev, struct module *owner, + void *data, size_t datalen, gfp_t gfp, + ssize_t (*read)(char *buffer, loff_t offset, + size_t count, void *data, + size_t datalen), + void (*free)(void *data), + unsigned long timeout) { free(data); } @@ -92,4 +97,29 @@ static inline void dev_coredump_put(struct device *dev) } #endif /* CONFIG_DEV_COREDUMP */ +/** + * dev_coredumpm - create device coredump with read/free methods + * @dev: the struct device for the crashed device + * @owner: the module that contains the read/free functions, use %THIS_MODULE + * @data: data cookie for the @read/@free functions + * @datalen: length of the data + * @gfp: allocation flags + * @read: function to read from the given buffer + * @free: function to free the given buffer + * + * Creates a new device coredump for the given device. If a previous one hasn't + * been read yet, the new coredump is discarded. The data lifetime is determined + * by the device coredump framework and when it is no longer needed the @free + * function will be called to free the data. + */ +static inline void dev_coredumpm(struct device *dev, struct module *owner, + void *data, size_t datalen, gfp_t gfp, + ssize_t (*read)(char *buffer, loff_t offset, size_t count, + void *data, size_t datalen), + void (*free)(void *data)) +{ + dev_coredumpm_timeout(dev, owner, data, datalen, gfp, read, free, + DEVCOREDUMP_TIMEOUT); +} + #endif /* __DEVCOREDUMP_H */ From patchwork Mon Mar 4 14:39:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Souza, Jose" X-Patchwork-Id: 209563 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp1463562dyc; Mon, 4 Mar 2024 06:40:39 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW3jg4uZlL80/TWz6rKrXoHIqUl2WDgWhBePuqV3wdPTnWeY3FHp6ko8MoOJMokrwAXEK1o+FClLa2m3EO5s6MYQ98OeQ== X-Google-Smtp-Source: AGHT+IGjJerSiwec7o+9IvMIEfCeOq/9xpTtCHemi6WHKj9KL2JBMVp23i3ozU9gqQTAiAriGcxK X-Received: by 2002:a19:f714:0:b0:512:acc8:7c36 with SMTP id z20-20020a19f714000000b00512acc87c36mr5674218lfe.58.1709563239319; Mon, 04 Mar 2024 06:40:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709563239; cv=pass; d=google.com; s=arc-20160816; b=h29gXXgk/TNF4lCUScb9SXaPzrULD7gVAD93+5ZN1E+fahyGgvLu4R2iIkVTQiW52k l5gd95XvguzSue857Pv4ZZmYdWISmbcHGoTO5GcRJJ31KH66wHSyLuJjavYOMRAAgkeh 1oU/tcs4RLqS0H/xor5uPPm+PeDWcKocyDGiTfZ/GrqFAIlPPvbreZdNBPNERn7G9JHh 2HR0h1S4XzT6JMYInG4BqmgSGmAtvQgRwkieOlrKnsOqA5qTEMbmnOh2TTxX0L+seX2o 2byKIEI1c5lv3IT0XnMBv1h4wi5VpnNJkq1TcIW9EPrCAajQvCmDpYHjPohlU02xRIqV i1Sw== 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=3Y1NkJd9wGERzMr+tdHd3dO7H78qHyX1QJaQPI5rUvk=; fh=iWkGsoy7TPTmscZDaNwAhCaNzZd4htfetWN3qPRQ3vU=; b=bqsrui4LKJixYHQajK9ZtHVLf6eRyd/E2hRx9VZW/YxnUE9XXeIpr4E8p39NDij9cN si9LeXtjBIBgwCXSkkaHZLFBAWLU7MHzEznFUre3oY5KLawRRJnm0Q71mZaaGv1cFF6p TQmRkklnXcRUaJ8PJsAM+aHs8/DlZJ1lW/LT7a+UOlR3oaj0ssvQR/EZKiMOgu3p4z23 W6Z3LQAsoeJkN2Eap4xXk3rPq9b+rYsZ2oWpQFjWM6LrOZT9keczNM3KG7TlFrbMAUpo cQfkljQqcRG3mzenEltqDzOGkkh+6XM85BBWXoykO1E45qCWeiNb7ftjB9cz7tMVnZYJ C1HQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VtKTOoVk; 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-90746-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90746-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id l17-20020a170906795100b00a43093bddaasi4202340ejo.313.2024.03.04.06.40.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 06:40:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90746-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=@intel.com header.s=Intel header.b=VtKTOoVk; 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-90746-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90746-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 am.mirrors.kernel.org (Postfix) with ESMTPS id BBA951F23EE3 for ; Mon, 4 Mar 2024 14:40:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8BC0F482EF; Mon, 4 Mar 2024 14:39:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="VtKTOoVk" 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 D11252575B for ; Mon, 4 Mar 2024 14:39:17 +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=1709563159; cv=none; b=VeR7miPmG8pbYUYybUQyd8raF8gvVcAXuAsa9WB8XRBVXOPXfPF4PpiYTG3FXpH3zgKDxXyTG8XrJejhPIQW3mjcXZG9WUSXRg2FHHJ1PnLr4vinVshEOy5J5s/w1hsk/3cDQR5FEQLlScfyd+BGJphEP2cPvuNfsJ/pmeAvc40= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709563159; c=relaxed/simple; bh=Ev9vAd6KMr30CCRVCaJ2grIXca9Zj7XJ7NQCoKyrOb0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AyK02Hh3jx/C0qJacrimq9mFMBv7BUsqqDPHY5u49vRI51e/MfKLtjtKg+2IZwJTb/3Sj1c7MtT5T486LchSZgZiEnQRLwNe6N9baJmGQDffU0wM4I9hcMJjxC2iImJIPVLHlEP3+KZUHcz1WXFe7WZlDkxDhLWbG/2qMQiNqdE= 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=VtKTOoVk; 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=1709563158; x=1741099158; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ev9vAd6KMr30CCRVCaJ2grIXca9Zj7XJ7NQCoKyrOb0=; b=VtKTOoVkkGwuP/NR+aSxEGhIDLJVaFfhK91Up617JSyVJ1D3sWaPdRdc J7bxO8aNaIsvtHg5vqTts2eGGTp+abkMm0gQebXBkF8JV8RPBUF+8qmEi zBC3lPWFElHiVZklsNpGZJitEZHbESRWfiPUG0MqXt9sUkIKBH9THoqG5 L6ETLw16WnSLDiGCC87qNNI7aXhA2tPk75ad0fXMKMlkFfJXpsEpzR/8K 3QRnDMOvAGABR4quIrC8wIYx72YSkhguMkNxjHEkEEIpe8jxLs9P/5Lit 9uEVXA+EB0Km7y4xqlJp6BHMO6Q9StA9n8IpDe6BhIiEU270aRIfIbtla w==; X-IronPort-AV: E=McAfee;i="6600,9927,11002"; a="15464639" X-IronPort-AV: E=Sophos;i="6.06,203,1705392000"; d="scan'208";a="15464639" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2024 06:39:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,203,1705392000"; d="scan'208";a="9162547" Received: from josouza-mobl2.bz.intel.com ([10.87.243.88]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2024 06:39:16 -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 , Jonathan Cavitt , =?utf-8?q?Jos=C3=A9_Roberto_de?= =?utf-8?q?_Souza?= Subject: [PATCH v3 3/4] drm/xe: Remove devcoredump during driver release Date: Mon, 4 Mar 2024 06:39:04 -0800 Message-ID: <20240304143905.52740-3-jose.souza@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240304143905.52740-1-jose.souza@intel.com> References: <20240304143905.52740-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: 1792606983072916704 X-GMAIL-MSGID: 1792606983072916704 This will remove devcoredump from file system and free its resources during driver unload. This fix the driver unload after gpu hang happened, otherwise this it would report that Xe KMD is still in use and it would leave the kernel in a state that Xe KMD can't be unload without a reboot. Cc: Rodrigo Vivi Cc: Jonathan Cavitt Acked-by: Jonathan Cavitt Signed-off-by: José Roberto de Souza --- drivers/gpu/drm/xe/xe_devcoredump.c | 13 ++++++++++++- drivers/gpu/drm/xe/xe_devcoredump.h | 5 +++++ drivers/gpu/drm/xe/xe_device.c | 4 ++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/xe/xe_devcoredump.c b/drivers/gpu/drm/xe/xe_devcoredump.c index 0fcd306803236..109c027188bd9 100644 --- a/drivers/gpu/drm/xe/xe_devcoredump.c +++ b/drivers/gpu/drm/xe/xe_devcoredump.c @@ -9,6 +9,8 @@ #include #include +#include + #include "xe_device.h" #include "xe_exec_queue.h" #include "xe_force_wake.h" @@ -230,5 +232,14 @@ void xe_devcoredump(struct xe_sched_job *job) dev_coredumpm(xe->drm.dev, THIS_MODULE, coredump, 0, GFP_KERNEL, xe_devcoredump_read, xe_devcoredump_free); } -#endif +static void xe_driver_devcoredump_fini(struct drm_device *drm, void *arg) +{ + dev_coredump_put(drm->dev); +} + +int xe_devcoredump_init(struct xe_device *xe) +{ + return drmm_add_action_or_reset(&xe->drm, xe_driver_devcoredump_fini, xe); +} +#endif diff --git a/drivers/gpu/drm/xe/xe_devcoredump.h b/drivers/gpu/drm/xe/xe_devcoredump.h index df8671f0b5eb2..9eba67f37234f 100644 --- a/drivers/gpu/drm/xe/xe_devcoredump.h +++ b/drivers/gpu/drm/xe/xe_devcoredump.h @@ -11,10 +11,15 @@ struct xe_sched_job; #ifdef CONFIG_DEV_COREDUMP void xe_devcoredump(struct xe_sched_job *job); +int xe_devcoredump_init(struct xe_device *xe); #else static inline void xe_devcoredump(struct xe_sched_job *job) { } +static inline int xe_devcoredump_init(struct xe_device *xe) +{ + return 0; +} #endif #endif diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c index 919ad88f0495a..22be76537c7da 100644 --- a/drivers/gpu/drm/xe/xe_device.c +++ b/drivers/gpu/drm/xe/xe_device.c @@ -20,6 +20,7 @@ #include "regs/xe_regs.h" #include "xe_bo.h" #include "xe_debugfs.h" +#include "xe_devcoredump.h" #include "xe_dma_buf.h" #include "xe_drm_client.h" #include "xe_drv.h" @@ -502,6 +503,9 @@ int xe_device_probe(struct xe_device *xe) return err; } + err = xe_devcoredump_init(xe); + if (err) + return err; err = drmm_add_action_or_reset(&xe->drm, xe_driver_flr_fini, xe); if (err) return err; From patchwork Mon Mar 4 14:39:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Souza, Jose" X-Patchwork-Id: 209564 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp1464027dyc; Mon, 4 Mar 2024 06:41:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWSVDpa2sAayIaOfxju5XYWL7bc0lt7oNKyoXnOfSElw+FxF80b4oILjpS+H3EoLO9OqHL21cC05RrDC/KW5JJpTpJBBQ== X-Google-Smtp-Source: AGHT+IGoyG1xfRqelz69S3zdnM9Ceb6HT5DqrBQp9NGl69oTvaJpIB2jVoZ6+6o3zXjhQiVtLrki X-Received: by 2002:a05:6808:dc5:b0:3c1:f692:8ded with SMTP id g5-20020a0568080dc500b003c1f6928dedmr567943oic.45.1709563291296; Mon, 04 Mar 2024 06:41:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709563291; cv=pass; d=google.com; s=arc-20160816; b=aIxmeoISjb00aCrmagXadhZBzHV76DRkWD5qGBHRh0+mKO87VIU3IaBc+tB1iSxXGA OUKme1hAr82qm9U/MYLWmhK/3DPjqfFq/xJIjD1TEWSJ/wvAcyT4T64EnFrKrMAnCuFW Fkzd9JbixlBcC97THjLkgE+B/O10M2vYmCAV3HcVZod7OlDmbPRKyQRClqirwQzwk8qi qTQhoETEk8mOrmET07OcDbQXPI9Xp3JdnHeieGjjV2emwGqFq2yQPCFxOnFVqLtglA+v jmHRW+aRNIRskyKNirGalJon5FnMDQXGXiJSa8qBIPh3CLiAQGNP6L2nSfoVlBVwyAlb q9Cw== 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=7d56sd/m9dIXtjbN0XPV7LjoZmJMo1g25wEJ7BSlmJI=; fh=iWkGsoy7TPTmscZDaNwAhCaNzZd4htfetWN3qPRQ3vU=; b=CocTI+yQSuOKuzGLIa39MbHzUynahN1f6CwJsRSP0tmFPF1er2ozo+tlNYYMoeUATk K96+keK0I1QpJosoGaDqTAxYm9gZObublKKYRMRsMm3xpm4GGyqJCGR724xCKsSjbGcX NIc109Lfoxb4pBjRwlrGOHrWNQrAXxP69oeUA74eJfQk/56pOkp3mqjyyl9Oji/u1XUn QU1Ls/n4w759WYFrcj6SZfKwdwLMarxK+NG8EF+SpQFpbMNM2UKT0A5Ydnakdcwdrr4u buSIKm3oeVo/lhHBqEZN0BS/93VTmVWLJ3ERGF2H75iDhZbU52ARcAxkag+v8VqNmk5h cCUg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fxTbWTPM; 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-90747-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90747-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. [147.75.199.223]) by mx.google.com with ESMTPS id 5-20020ac85945000000b0042ef63a31f3si1289612qtz.51.2024.03.04.06.41.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 06:41:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90747-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fxTbWTPM; 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-90747-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90747-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 BEEAA1C21B36 for ; Mon, 4 Mar 2024 14:40:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 09E8A4AEEE; Mon, 4 Mar 2024 14:39:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="fxTbWTPM" 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 8026245BF6 for ; Mon, 4 Mar 2024 14:39: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=1709563161; cv=none; b=gJ+KCj5zoFrPw2vEAiV+iaM0nNL/fthZADKGk16JRjr8ILjJzg61U+y7ZGumlfi5Slc3iT4yckhcxQGdaflm8NVLjuTmxxH2dN9wY2/JBGU8+b4lyj1iKMvnnV6knoulWSX0eb3m6jOjBQQnnp5znOyNb5jBMDE2j0t2e4aaVwM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709563161; c=relaxed/simple; bh=TQZp5xpOX2dnHZfG1mH9kj65SYkNhEAl0tLk1zElFu0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uCiE6aIjKPW5DmpSMMI6WAAwmwZEa/Y25IxvSe3xRFPUOWOdQV0GJycNY4hWI4ZaOVqT8cN749Byn2c59m4oSLIhKSbCivjI6AM9AzSBtMB0kldwjaJbhN1ES0T3LQFiM8sAyh7HNzvU3XPAESDay9EwXRBjsyexxMFTVew+VYI= 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=fxTbWTPM; 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=1709563159; x=1741099159; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TQZp5xpOX2dnHZfG1mH9kj65SYkNhEAl0tLk1zElFu0=; b=fxTbWTPM6vY/SxI7rqxSR1H3NzoWUV1/AUSyNp/Sx/ezxh6hhqgH8V0n TlWm0kt1bOoBTvsFLPfHQ4+7Ft3Kc5QGmOQVn6hcGKJ7+Sr87uRXWjJHF b4zYBoPX3VoAtE93HX3Gb2XTSEvT6H2rIHr6Ge9f28bAX0JN7wsuMMEjk 2uhZVEhppkDYglOT/VZOX4HWM/LOWciBZqsOfN1iQZKXFeo0Fw00cNZt8 kZzaU3r4ytx/F/M9kHtbxc2OuYjbAACAAyVytaL+0uuQAWVv1JhUvbnev meExvP4Tz8pdUg8JTpQknzh/1paqPDsfuphR++SR5VCstWRW3WpLf0gb2 g==; X-IronPort-AV: E=McAfee;i="6600,9927,11002"; a="15464644" X-IronPort-AV: E=Sophos;i="6.06,203,1705392000"; d="scan'208";a="15464644" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2024 06:39:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,203,1705392000"; d="scan'208";a="9162552" Received: from josouza-mobl2.bz.intel.com ([10.87.243.88]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2024 06:39:18 -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 , Jonathan Cavitt , =?utf-8?q?Jos=C3=A9_Roberto_de?= =?utf-8?q?_Souza?= Subject: [PATCH v3 4/4] drm/xe: Increase devcoredump timeout Date: Mon, 4 Mar 2024 06:39:05 -0800 Message-ID: <20240304143905.52740-4-jose.souza@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240304143905.52740-1-jose.souza@intel.com> References: <20240304143905.52740-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: 1792607038069944916 X-GMAIL-MSGID: 1792607038069944916 5 minutes is too short for a regular user to search and understand what he needs to do to report capture devcoredump and report a bug to us, so here increasing this timeout to 1 hour. Cc: Rodrigo Vivi Cc: Jonathan Cavitt Acked-by: Jonathan Cavitt Signed-off-by: José Roberto de Souza --- drivers/gpu/drm/xe/xe_devcoredump.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_devcoredump.c b/drivers/gpu/drm/xe/xe_devcoredump.c index 109c027188bd9..08c60531e0db4 100644 --- a/drivers/gpu/drm/xe/xe_devcoredump.c +++ b/drivers/gpu/drm/xe/xe_devcoredump.c @@ -52,6 +52,9 @@ #ifdef CONFIG_DEV_COREDUMP +/* 1 hour timeout */ +#define XE_COREDUMP_TIMEOUT_JIFFIES (60 * 60 * HZ) + static struct xe_device *coredump_to_xe(const struct xe_devcoredump *coredump) { return container_of(coredump, struct xe_device, devcoredump); @@ -229,8 +232,9 @@ void xe_devcoredump(struct xe_sched_job *job) drm_info(&xe->drm, "Check your /sys/class/drm/card%d/device/devcoredump/data\n", xe->drm.primary->index); - dev_coredumpm(xe->drm.dev, THIS_MODULE, coredump, 0, GFP_KERNEL, - xe_devcoredump_read, xe_devcoredump_free); + dev_coredumpm_timeout(xe->drm.dev, THIS_MODULE, coredump, 0, GFP_KERNEL, + xe_devcoredump_read, xe_devcoredump_free, + XE_COREDUMP_TIMEOUT_JIFFIES); } static void xe_driver_devcoredump_fini(struct drm_device *drm, void *arg)