From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FC1AC00A89 for ; Fri, 30 Oct 2020 15:05:03 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8EC0A20791 for ; Fri, 30 Oct 2020 15:05:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Eq/UNgbm"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="OxvudRJg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8EC0A20791 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=DgYSf0oTZSgYkyHqfhVwoHrTxZqKLVTwA0hUobAYk0Q=; b=Eq/UNgbmqn5IM88+2a69c43uj +W4hh3CMaVqYBJh3Nuyol+lhFsLjtXNL7xWdND8Xgj5AICrQ+Bx+eEy5WdHWc5ioBqMxMQraVnFLq p3EUrBQW3toZaRL2TZRZV22EIoBjU14AFHZDOMrvJry80Mjjy+dWVCfxhsBDTtkmQg6cnH9GyUpNT 1bV1993spmCB00u+2M5Co3tNb0SKwhVfwvJh/Z1PfIZDdu+dZUGNh3ztaV8/RzhlEFZ1V6+Fg+afO rnjH9nrzcroLIU0ktYRdHZhsYVxST7RI+sp24aR2GInag3v9p/a7wa/gblCNbqhaAp6pNenELoqJU x47/18Cbg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYVx5-0000ut-1Q; Fri, 30 Oct 2020 15:04:27 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYVx2-0000uN-2X for linux-arm-kernel@lists.infradead.org; Fri, 30 Oct 2020 15:04:25 +0000 Received: by mail-pl1-x643.google.com with SMTP id 1so3094320ple.2 for ; Fri, 30 Oct 2020 08:04:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=yKh1gww6LqRAEgf9eBUACjdeNH/81Jlt6VPrqpP9HjY=; b=OxvudRJgIRIEEE/kopiv2wGC9KQul3KWIc59iINcgjgEcQO8qfQgK8xCsvR6bU+eU6 FDQ1qaBXWySGwMUYEsNEsDv0aTIGv5YQaFZm5lXPjeB2wFlAXLWEhTMyK4oAp0PoqL+F iuABlXhO0J/WJ1ufpzjcUec4SA4o0YYcsaSu8xG+OYXxD7BtwIJ9dV7tXa9mXZRPr+vT UUiEEZXtOLTd4vzqssygE6Oa63FI3uxWTQEyUwcywZ29vuLuIWc9QOlZjyjXoeUkHa9h hNTW8ftmJLgA1FECCCSdjcjedOdB+RPZii6KXMkFLuRElNHntKWZNEiKf9SVIZssfYr4 yx+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=yKh1gww6LqRAEgf9eBUACjdeNH/81Jlt6VPrqpP9HjY=; b=d303RVACSZBzyceT6KNtKB6uTxdM5txRsvwfFOhWodtpsSWVFh1jDDxFm6x1q6FHqz 4lQNJyRopVA2jlReizp7kbdbbfxIsQCPoePuT1o3ogrz8sFXkSeXUIB0VH61xWFqMRwa Xo0wnk8Rljwa0aKrNnhU4tJSgPNgjvkC2v6YsB9OHxFFMKgAAEsf2xBkFVorf2CrF6LP h/8FBS3GDIQom8aGVN95lfgIkSFT5tMlpOXyk03ESadN9sV4zTOaL65UN7atpMTdLfCU QxN5vgAZSQYCGtXoNHPIlPMTUyzR6ba4TiTxHZxxtdZpMqDytBdqLzOZ9x2z1sOER3hW e4Nw== X-Gm-Message-State: AOAM531fHd8h7YHSs85fNI3eP5bTL4Dkm+DTSzyXXOUgW3QibQ4P2hJO nFOyQ74mkxi9D1cLrivIICQHhw== X-Google-Smtp-Source: ABdhPJzP0hrIb7ygkUfGzrbXaNTTe638OLEyXudJh20SphijYKQVMD6quFCnALW7JPRcfJXLPc0m2Q== X-Received: by 2002:a17:902:c084:b029:d6:b04a:b091 with SMTP id j4-20020a170902c084b02900d6b04ab091mr675658pld.14.1604070261958; Fri, 30 Oct 2020 08:04:21 -0700 (PDT) Received: from xps15 (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id a19sm3685615pjq.29.2020.10.30.08.04.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Oct 2020 08:04:20 -0700 (PDT) Date: Fri, 30 Oct 2020 09:04:18 -0600 From: Mathieu Poirier To: Greg KH Subject: Re: [PATCH 1/2] coresight: cti: Initialize dynamic sysfs attributes Message-ID: <20201030150418.GA1298977@xps15> References: <20201029164559.1268531-1-mathieu.poirier@linaro.org> <20201029164559.1268531-2-mathieu.poirier@linaro.org> <20201029191011.GA826513@kroah.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201029191011.GA826513@kroah.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201030_110424_258437_4B79354A X-CRM114-Status: GOOD ( 23.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Oct 29, 2020 at 08:10:11PM +0100, Greg KH wrote: > 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 > :) Oh - I (wrongly) assumed all patches with a "Fixes" tag were going to stable. > > thanks, > > greg k-h _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel