Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp697612pxx; Thu, 29 Oct 2020 12:12:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9BiZuSRFhtpgaGh5EaEj18GxYTi9HKqBffQXUG8+Tw8BdX3hCq4t8ivv+/AtlEIlVfS87 X-Received: by 2002:a17:906:b104:: with SMTP id u4mr5360334ejy.121.1603998767634; Thu, 29 Oct 2020 12:12:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603998767; cv=none; d=google.com; s=arc-20160816; b=VQXqfsmOTL2eibebHQgZ5sTAdybAHDpPp8R+NpvbgW2+8w81gFwPZ7AtDGhhQa5iV5 nEVQ2BYwZakdorvEnUyXTOJ2IMDy274ycTnL+uYEJ0DSGfXSZ9I0R1HPV1VMjc3QYhNq wzMHqcURcMzshsNxdLbQBOaeKNanjkJCkFTmvgoOBZlxiubhW0I8RqKEKc8jT8FACxSd 8itkaHUHWh7ijbeRbO8aCmAEG40kc+E+/Qkvf4CThoCuiwBwhRXBtlNUKTC/ic/xhf1z HcBVUWtHCkFPN2MeO/h9sVJeDvNzIXGBTBdeYfOBJ8gl9NAsunIE9mBPxkWUREyY5GRd yMVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=DO2PD4T5yWPJUMt0vvljQGrrhZUCwjNZp0nUxTAd/4U=; b=lElvX2J0k6Lac5lsLAV7f/8HvMxRUtFM4PgmUj3cqtE6Dqeb0a7YyD4FlabTJDtHJs IO2p3XEdyIE3Ta3snoZhykQlWakIJlcofKyZI6baSL5SCpgHqO63FRYTBmPo/PNTz5To +A8y2FoNvNanTIH3DlOBOnFYwu3HnNeU1WkVDBI/XZj4wXwFccmLEHXvozqiL4GY7WI4 34jKoRPqLYV6xJn1zwfVCN1sXG8sGKDzuduj+jf6b3+R1SidnfZLf4KZ2m1JQ6MTld1P +tcL4OxuQQFJo2dlsL1ZfEM72KsTtA31hbSEU2MKjfh6Loj4TBQN0wE/Ms26JsQMAtFD qE4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Uk6TyvBZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i21si2154015ejc.179.2020.10.29.12.12.24; Thu, 29 Oct 2020 12:12:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Uk6TyvBZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726065AbgJ2TJv (ORCPT + 99 others); Thu, 29 Oct 2020 15:09:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:44090 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725791AbgJ2TJf (ORCPT ); Thu, 29 Oct 2020 15:09:35 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B730020756; Thu, 29 Oct 2020 19:09:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603998563; bh=Pt6WFzMLYTX0xhEREmX9YvFBIhL4r4F+3MKqRLIaqbQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Uk6TyvBZKB9y7WjP0zclRkEjbT/gg4W0oGC0Me1DwJERMBFa8/UaqvyCm0d2R8LLY 7+NxOIT4l25TEkcWGM9v581sCaVX2tcENARVb3QwLW8ot3qEOfUhC1A1dkY5zjc4UQ 26j1wSDsT5SkfWUi9XlrSzudIcC8wrbRh+EGtj6Q= Date: Thu, 29 Oct 2020 20:10:11 +0100 From: Greg KH To: Mathieu Poirier Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] coresight: cti: Initialize dynamic sysfs attributes Message-ID: <20201029191011.GA826513@kroah.com> References: <20201029164559.1268531-1-mathieu.poirier@linaro.org> <20201029164559.1268531-2-mathieu.poirier@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201029164559.1268531-2-mathieu.poirier@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 29, 2020 at 10:45:58AM -0600, Mathieu Poirier wrote: > From: Suzuki K Poulose > > With LOCKDEP enabled, CTI driver triggers the following splat due > to uninitialized lock class for dynamically allocated attribute > objects. > > [ 5.372901] coresight etm0: CPU0: ETM v4.0 initialized > [ 5.376694] coresight etm1: CPU1: ETM v4.0 initialized > [ 5.380785] coresight etm2: CPU2: ETM v4.0 initialized > [ 5.385851] coresight etm3: CPU3: ETM v4.0 initialized > [ 5.389808] BUG: key ffff00000564a798 has not been registered! > [ 5.392456] ------------[ cut here ]------------ > [ 5.398195] DEBUG_LOCKS_WARN_ON(1) > [ 5.398233] WARNING: CPU: 1 PID: 32 at kernel/locking/lockdep.c:4623 lockdep_init_map_waits+0x14c/0x260 > [ 5.406149] Modules linked in: > [ 5.415411] CPU: 1 PID: 32 Comm: kworker/1:1 Not tainted 5.9.0-12034-gbbe85027ce80 #51 > [ 5.418553] Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT) > [ 5.426453] Workqueue: events amba_deferred_retry_func > [ 5.433299] pstate: 40000005 (nZcv daif -PAN -UAO -TCO BTYPE=--) > [ 5.438252] pc : lockdep_init_map_waits+0x14c/0x260 > [ 5.444410] lr : lockdep_init_map_waits+0x14c/0x260 > [ 5.449007] sp : ffff800012bbb720 > ... > > [ 5.531561] Call trace: > [ 5.536847] lockdep_init_map_waits+0x14c/0x260 > [ 5.539027] __kernfs_create_file+0xa8/0x1c8 > [ 5.543539] sysfs_add_file_mode_ns+0xd0/0x208 > [ 5.548054] internal_create_group+0x118/0x3c8 > [ 5.552307] internal_create_groups+0x58/0xb8 > [ 5.556733] sysfs_create_groups+0x2c/0x38 > [ 5.561160] device_add+0x2d8/0x768 > [ 5.565148] device_register+0x28/0x38 > [ 5.568537] coresight_register+0xf8/0x320 > [ 5.572358] cti_probe+0x1b0/0x3f0 > > ... > > Fix this by initializing the attributes when they are allocated. > > Fixes: 3c5597e39812 ("coresight: cti: Add connection information to sysfs") > Reported-by: Leo Yan > Tested-by: Leo Yan > Cc: Mike Leach > Cc: Mathieu Poirier > Signed-off-by: Suzuki K Poulose > Signed-off-by: Mathieu Poirier > --- > drivers/hwtracing/coresight/coresight-cti-sysfs.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/hwtracing/coresight/coresight-cti-sysfs.c b/drivers/hwtracing/coresight/coresight-cti-sysfs.c > index 392757f3a019..7ff7e7780bbf 100644 > --- a/drivers/hwtracing/coresight/coresight-cti-sysfs.c > +++ b/drivers/hwtracing/coresight/coresight-cti-sysfs.c > @@ -1065,6 +1065,13 @@ static int cti_create_con_sysfs_attr(struct device *dev, > } > eattr->var = con; > con->con_attrs[attr_idx] = &eattr->attr.attr; > + /* > + * Initialize the dynamically allocated attribute > + * to avoid LOCKDEP splat. See include/linux/sysfs.h > + * for more details. > + */ > + sysfs_attr_init(con->con_attrs[attr_idx]); > + > return 0; > } Should go to stable kernels too, as the patch this fixes is in 5.7. I'll add the stable tag here, but feel free to do it yourself next time :) thanks, greg k-h