All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jeffery <andrew@aj.id.au>
To: joel@jms.id.au, jk@ozlabs.org, eajames@linux.vnet.ibm.com,
	bradleyb@fuzziesquirrel.com, cbostic@linux.vnet.ibm.com
Cc: Andrew Jeffery <andrew@aj.id.au>, openbmc@lists.ozlabs.org
Subject: [PATCH linux dev-4.13 11/16] hwmon (p9_sbe): Add static key to satisfy lockdep
Date: Tue, 20 Feb 2018 14:48:39 +1030	[thread overview]
Message-ID: <20180220041844.13228-12-andrew@aj.id.au> (raw)
In-Reply-To: <20180220041844.13228-1-andrew@aj.id.au>

Previously we received the following warning:

[    7.221161] INFO: trying to register non-static key.
[    7.226163] the code is fine but needs lockdep annotation.
[    7.231650] turning off the locking correctness validator.
[    7.237152] CPU: 0 PID: 1 Comm: swapper Tainted: G        W       4.13.16-00190-g78a200cb21ab #2393
[    7.246194] Hardware name: Generic DT based system
[    7.251040] [<8001141c>] (unwind_backtrace) from [<8000e87c>] (show_stack+0x20/0x24)
[    7.258827] [<8000e87c>] (show_stack) from [<804a65ec>] (dump_stack+0x20/0x28)
[    7.266098] [<804a65ec>] (dump_stack) from [<80054b08>] (register_lock_class+0x270/0x614)
[    7.274308] [<80054b08>] (register_lock_class) from [<800589f0>] (__lock_acquire+0x7c/0x17f4)
[    7.282857] [<800589f0>] (__lock_acquire) from [<8005ac18>] (lock_acquire+0xd8/0x204)
[    7.290719] [<8005ac18>] (lock_acquire) from [<804c0dcc>] (_raw_spin_lock_irqsave+0x60/0x74)
[    7.299200] [<804c0dcc>] (_raw_spin_lock_irqsave) from [<8035ecc0>] (p9_sbe_occ_send_cmd+0x30/0x100)
[    7.308363] [<8035ecc0>] (p9_sbe_occ_send_cmd) from [<8035c9ac>] (occ_poll+0x60/0x210)
[    7.316309] [<8035c9ac>] (occ_poll) from [<8035d9c8>] (occ_setup+0x50/0x1260)
[    7.323475] [<8035d9c8>] (occ_setup) from [<8035edf0>] (p9_sbe_occ_probe+0x60/0x7c)
[    7.331167] [<8035edf0>] (p9_sbe_occ_probe) from [<802b97c8>] (platform_drv_probe+0x60/0xbc)
[    7.339629] [<802b97c8>] (platform_drv_probe) from [<802b78f0>] (driver_probe_device+0x2e4/0x450)
[    7.348516] [<802b78f0>] (driver_probe_device) from [<802b7c0c>] (__device_attach_driver+0xa4/0x10c)
[    7.357668] [<802b7c0c>] (__device_attach_driver) from [<802b5de0>] (bus_for_each_drv+0x54/0xa4)
[    7.366477] [<802b5de0>] (bus_for_each_drv) from [<802b7454>] (__device_attach+0xc0/0x148)
[    7.374758] [<802b7454>] (__device_attach) from [<802b7cd8>] (device_initial_probe+0x1c/0x20)
[    7.383301] [<802b7cd8>] (device_initial_probe) from [<802b5ff8>] (bus_probe_device+0x98/0xa0)
[    7.391943] [<802b5ff8>] (bus_probe_device) from [<802b426c>] (device_add+0x398/0x5c4)
[    7.399895] [<802b426c>] (device_add) from [<8037ab10>] (of_device_add+0x40/0x48)
[    7.407405] [<8037ab10>] (of_device_add) from [<8037b618>] (of_platform_device_create_pdata+0x88/0xc8)
[    7.416735] [<8037b618>] (of_platform_device_create_pdata) from [<8037b94c>] (of_platform_device_create+0x20/0x24)
[    7.427109] [<8037b94c>] (of_platform_device_create) from [<80394894>] (occ_probe+0x19c/0x238)
[    7.435746] [<80394894>] (occ_probe) from [<802b97c8>] (platform_drv_probe+0x60/0xbc)
[    7.443604] [<802b97c8>] (platform_drv_probe) from [<802b78f0>] (driver_probe_device+0x2e4/0x450)
[    7.452497] [<802b78f0>] (driver_probe_device) from [<802b7b28>] (__driver_attach+0xcc/0x10c)
[    7.461044] [<802b7b28>] (__driver_attach) from [<802b58a4>] (bus_for_each_dev+0x5c/0xac)
[    7.469240] [<802b58a4>] (bus_for_each_dev) from [<802b7d04>] (driver_attach+0x28/0x30)
[    7.477258] [<802b7d04>] (driver_attach) from [<802b62dc>] (bus_add_driver+0x194/0x254)
[    7.485284] [<802b62dc>] (bus_add_driver) from [<802b8b54>] (driver_register+0x88/0x104)
[    7.493398] [<802b8b54>] (driver_register) from [<802ba42c>] (__platform_driver_register+0x3c/0x50)
[    7.502469] [<802ba42c>] (__platform_driver_register) from [<803943f0>] (occ_init+0x58/0x80)
[    7.510945] [<803943f0>] (occ_init) from [<80669f1c>] (do_one_initcall+0xb0/0x170)
[    7.518545] [<80669f1c>] (do_one_initcall) from [<8066a0f4>] (kernel_init_freeable+0x118/0x1d0)
[    7.527280] [<8066a0f4>] (kernel_init_freeable) from [<804b9b94>] (kernel_init+0x18/0x104)
[    7.535579] [<804b9b94>] (kernel_init) from [<8000a868>] (ret_from_fork+0x14/0x2c)

Provide a static key to lockdep to help with this dynamically allocated mutex.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
 drivers/hwmon/occ/p9_sbe.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/hwmon/occ/p9_sbe.c b/drivers/hwmon/occ/p9_sbe.c
index 38cf57ad1bb8..b84cb1733fdf 100644
--- a/drivers/hwmon/occ/p9_sbe.c
+++ b/drivers/hwmon/occ/p9_sbe.c
@@ -16,6 +16,9 @@
 
 #include "common.h"
 
+/* Satisfy lockdep's need for static keys */
+static struct lock_class_key p9_sbe_occ_client_lock_key;
+
 struct p9_sbe_occ {
 	struct occ occ;
 	struct device *sbe;
@@ -114,6 +117,7 @@ static int p9_sbe_occ_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	mutex_init(&ctx->client_lock);
+	lockdep_set_class(&ctx->client_lock, &p9_sbe_occ_client_lock_key);
 	ctx->sbe = pdev->dev.parent;
 	occ = &ctx->occ;
 	occ->bus_dev = &pdev->dev;
-- 
2.14.1

  parent reply	other threads:[~2018-02-20  4:19 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-20  4:18 [PATCH linux dev-4.13 00/16] Locking fixes for FSI, SBEFIFO, OCC Andrew Jeffery
2018-02-20  4:18 ` [PATCH linux dev-4.13 01/16] dts: fsi: Make OCC description match expected hierarchy Andrew Jeffery
2018-02-22 20:25   ` Eddie James
2018-02-23  0:15     ` Andrew Jeffery
2018-02-20  4:18 ` [PATCH linux dev-4.13 02/16] hwmon (p9_sbe): Initialise device spin lock Andrew Jeffery
2018-02-22 20:26   ` Eddie James
2018-02-20  4:18 ` [PATCH linux dev-4.13 03/16] fsi: sbefifo: Rename sbefifo_release_client() for consistency Andrew Jeffery
2018-02-22 20:28   ` Eddie James
2018-02-20  4:18 ` [PATCH linux dev-4.13 04/16] fsi: sbefifo: Add tracing of transfers Andrew Jeffery
2018-02-22 20:28   ` Eddie James
2018-02-20  4:18 ` [PATCH linux dev-4.13 05/16] fsi: gpio: Trace busy count Andrew Jeffery
2018-02-22 20:29   ` Eddie James
2018-02-20  4:18 ` [PATCH linux dev-4.13 06/16] fsi: occ: Add tracepoints Andrew Jeffery
2018-02-22 20:29   ` Eddie James
2018-02-20  4:18 ` [PATCH linux dev-4.13 07/16] fsi: sbefifo: don't delete canceled xfrs in write Andrew Jeffery
2018-02-20  4:18 ` [PATCH linux dev-4.13 08/16] hwmon (p9_sbe): Rename context variable Andrew Jeffery
2018-02-22 20:30   ` Eddie James
2018-02-20  4:18 ` [PATCH linux dev-4.13 09/16] hwmon (p9_sbe): Rename lock member of struct p9_sbe_occ Andrew Jeffery
2018-02-22 20:31   ` Eddie James
2018-02-20  4:18 ` [PATCH linux dev-4.13 10/16] hwmon (p9_sbe): Convert client_lock from a spinlock to a mutex Andrew Jeffery
2018-02-22 20:31   ` Eddie James
2018-02-20  4:18 ` Andrew Jeffery [this message]
2018-02-22 20:32   ` [PATCH linux dev-4.13 11/16] hwmon (p9_sbe): Add static key to satisfy lockdep Eddie James
2018-02-20  4:18 ` [PATCH linux dev-4.13 12/16] fsi: sbefifo: Avoid using a timer to drive FIFO transfers Andrew Jeffery
2018-02-20  4:18 ` [PATCH linux dev-4.13 13/16] fsi: sbefifo: Switch to mutex in work function Andrew Jeffery
2018-02-20  4:18 ` [PATCH linux dev-4.13 14/16] fsi: sbefifo: Switch list_lock from spinlock to mutex Andrew Jeffery
2018-02-22 20:35   ` Eddie James
2018-02-20  4:18 ` [PATCH linux dev-4.13 15/16] fsi: gpio: Remove unused 'id' variable Andrew Jeffery
2018-02-20  4:18 ` [PATCH linux dev-4.13 16/16] fsi: gpio: Use a mutex to protect transfers Andrew Jeffery

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180220041844.13228-12-andrew@aj.id.au \
    --to=andrew@aj.id.au \
    --cc=bradleyb@fuzziesquirrel.com \
    --cc=cbostic@linux.vnet.ibm.com \
    --cc=eajames@linux.vnet.ibm.com \
    --cc=jk@ozlabs.org \
    --cc=joel@jms.id.au \
    --cc=openbmc@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.