Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2558432rbb; Wed, 28 Feb 2024 05:50:59 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWj7sQInuOhVe+yiPXGyO6yo0eIB6CGVvauwVM6t/+zS03cddBKgF0r6jYR8ocJCP1KV1CyU7w0TSrMkzzDiS3AF9a6hb5WQWg7BmmCMQ== X-Google-Smtp-Source: AGHT+IFZVDaCfDfrujZL37j1ytpi2VL7Ak2LAV3iwzmgOMxehA3xWWA1ggzZAECl3kKKCOW+HJ/J X-Received: by 2002:a05:6a20:e68b:b0:1a0:e639:7adc with SMTP id mz11-20020a056a20e68b00b001a0e6397adcmr5393490pzb.16.1709128259130; Wed, 28 Feb 2024 05:50:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709128259; cv=pass; d=google.com; s=arc-20160816; b=FbE2MJaGmIOct+vgJlHZKIAGjWRbiol+nlH6z6YPUKlrsbSGvPXpNdnDPoM2xisPQF tlhdu5e/NOOC8nzIjFcXiWvA7EFiGUc6QR3Q38N3Y+Qgbs9KaR1jIhzNUuJGhWVUQ3zT aXdkWgMDZk8bGCSSGTwGF5KHHuNKVLyeABfLIatJpvQX3mtm3W/T5lE4HH4XIRKILU9i Zwof+QXdvgeNHZ/ZejBxhmCAvaFdoSruRnrDSTGt8N8Y136zo3LBUx08ww4bb0yVCBEe iqru1LZNRAxd11hqgS5aN9oVq37Wj6VhVLzQ5aMuIy5Ek7d4PHRmhhOnClLIupjd5YX/ 2EsQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=gbbaIjKyJYqdiJn3LCuTCwFTxGo+XR59Kj1/OOErhfk=; fh=ufDB6B+/d5loiIV69f1rACAhVbgQMOF96UUua1WqZSM=; b=hcc2J6tpR3Eqe+p6qM4V/+Cru6cq7c9Z7MLmcCcxru6Dxsu44gfaehiNwNi3a0nZku fDpP3pJkSLKmQxtTTSDmqxLDnoygCl9Qs5hdUCtA82HVr7hQXtcXGZaen1MbfJccuxuD ccUgcs2jV+0dBB5WLxLlSMxeT9CRA0gijhalSfGNRweRNm+JuTDHuqeNQcdnPOUKBcOK qK1ifwmshuyUIDaD4iVGGEHsSPUKLrLgPFutofZrzhfGhukDaJmXQ5/snpUWDKjmyIAs +O7vNdW5QfGVUvjhBIP86+EbdfXeLYmLOyG7L71HbKns1FKEFrZ4qhbBT/KWZN3IryMC mgjg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=RajPwTXj; 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-85122-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85122-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id s5-20020a63e805000000b005cdd9963f49si7616099pgh.863.2024.02.28.05.50.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 05:50:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85122-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=RajPwTXj; 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-85122-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85122-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id E8BF028C2F4 for ; Wed, 28 Feb 2024 13:43:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A26CE14EFEB; Wed, 28 Feb 2024 13:43:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="RajPwTXj" Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 E8BF7130AEF for ; Wed, 28 Feb 2024 13:43:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709127790; cv=none; b=irhzKdlaCKuBTvZ8G+gJdzLZFV8Y4vXwxu/rAv723EjJjGtafKsMp1T67oyw7mb+9VO35vBQ85yzxKMnOfApfDYrG8LAiqjlvA5rfFPOHPwv0iAbj05YUyzd6UJtI/fsSB9G66KokPuj3Lxs6ZaV+8eiwOVZBI21LKQo626SXsw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709127790; c=relaxed/simple; bh=SvOjEBM6XaTjawBpJfnC/vAcSjjGGP5H8FoPZUwyDR4=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=TnQcSjh2G30hDlVe+6t1ngZ8nXLls+OK9Z/M6vo8U7aR0fmE9o9vlb0CaEcrlC3ypVC6s/dsZKo1X1GvcOWtDpdivBYdOIgs3t+skqYh5aOKZSkfOYQt6xWdnIUWTGKUq+XEEAgye4O096CxmXBQ2Z51MmQAIVN5WCd2TdcIJOk= 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=RajPwTXj; arc=none smtp.client-ip=205.220.180.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 (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41SDe2Qc012073; Wed, 28 Feb 2024 13:43:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s= qcppdkim1; bh=gbbaIjKyJYqdiJn3LCuTCwFTxGo+XR59Kj1/OOErhfk=; b=Ra jPwTXjsRX23YHsuwKQ3s0tKtcBH8rGAfIDCf5hw0PrgKaJXahj10wk/B14U+T2dS pNOYvJ0mXRHI04MBDWZa90wuznxC3OoyqYIpbo8UaIxItAezyrz7k4wvdZUcQwRg znrR75nd7kb4oFQCM4iE8hTgOHjWocGE1QkfKCRN+ZlWxfpghdEFLxWt9ITzNVJ4 Lm8CxgRerdON0W3WGdKs5uzfpvBmYX16dq1o1TaHhgPFsrtO0OUx1fVZ2fceuSX+ 4wYfob+rSnkltURFsO5iP7MzvsF1kmFSfExC9i2UWyXWZMtKAbMNyxIsBl/oDwCg awS2JATXPlQN0hqbmBZg== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wj5wc8093-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Feb 2024 13:43:01 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41SDh0sc004702 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Feb 2024 13:43:00 GMT Received: from [10.214.66.81] (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Wed, 28 Feb 2024 05:42:58 -0800 Message-ID: Date: Wed, 28 Feb 2024 19:12:53 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH 1/4] devcoredump: Add dev_coredump_put() Content-Language: en-US To: =?UTF-8?Q?Jos=c3=a9_Roberto_de_Souza?= , , CC: Rodrigo Vivi , Johannes Berg , Jonathan Cavitt References: <20240227210008.182904-1-jose.souza@intel.com> From: Mukesh Ojha In-Reply-To: <20240227210008.182904-1-jose.souza@intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: c4sVrRvDN_S1dI-labytC-2CfvTIQqnA X-Proofpoint-ORIG-GUID: c4sVrRvDN_S1dI-labytC-2CfvTIQqnA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-28_06,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 clxscore=1015 priorityscore=1501 mlxlogscore=928 mlxscore=0 phishscore=0 bulkscore=0 suspectscore=0 impostorscore=0 spamscore=0 malwarescore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402280108 On 2/28/2024 2:30 AM, José Roberto de Souza wrote: > This is useful for drivers that don't want to keep a coredump > available after unloading. > Otherwise, the coredump would only be removed after DEVCD_TIMEOUT > seconds. > > Cc: Rodrigo Vivi > Cc: Mukesh Ojha > Cc: Johannes Berg > Cc: Jonathan Cavitt > Signed-off-by: José Roberto de Souza > --- > drivers/base/devcoredump.c | 22 ++++++++++++++++++++++ > include/linux/devcoredump.h | 5 +++++ > 2 files changed, 27 insertions(+) > > diff --git a/drivers/base/devcoredump.c b/drivers/base/devcoredump.c > index 7e2d1f0d903a6..e96427411b87c 100644 > --- a/drivers/base/devcoredump.c > +++ b/drivers/base/devcoredump.c > @@ -304,6 +304,28 @@ 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 > + * > + * If giving device has a coredump this removes it from file system and free > + * associated data otherwise does nothing. > + * This is useful for drivers that don't want to keep a coredump > + * available after unloading. > + */ [...] Slight rephrasing.. "" 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. "" Overall, LGTM.. -Mukesh > +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 */