From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org,
Alexander Shishkin <alexander.shishkin@linux.intel.com>
Subject: [PATCH 1/2] stm class: Mark src::link __rcu
Date: Tue, 6 Oct 2015 12:47:17 +0300 [thread overview]
Message-ID: <1444124838-27049-2-git-send-email-alexander.shishkin@linux.intel.com> (raw)
In-Reply-To: <1444124838-27049-1-git-send-email-alexander.shishkin@linux.intel.com>
Source device's link is protected with srcu, mark it as such to have
proper build-time validation of accesses to this field. The update
side that's dereferencing it under an update lock also needs an
accessor to dereference this field to keep sparse happy.
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
---
drivers/hwtracing/stm/core.c | 9 ++++++---
drivers/hwtracing/stm/stm.h | 2 +-
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c
index b79c42c625..b6445d9e54 100644
--- a/drivers/hwtracing/stm/core.c
+++ b/drivers/hwtracing/stm/core.c
@@ -781,17 +781,20 @@ fail_detach:
static void __stm_source_link_drop(struct stm_source_device *src,
struct stm_device *stm)
{
+ struct stm_device *link;
+
spin_lock(&src->link_lock);
- if (WARN_ON_ONCE(src->link != stm)) {
+ link = srcu_dereference_check(src->link, &stm_source_srcu, 1);
+ if (WARN_ON_ONCE(link != stm)) {
spin_unlock(&src->link_lock);
return;
}
- stm_output_free(src->link, &src->output);
+ stm_output_free(link, &src->output);
/* caller must hold stm::link_lock */
list_del_init(&src->link_entry);
/* matches stm_find_device() from stm_source_link_store() */
- stm_put_device(src->link);
+ stm_put_device(link);
rcu_assign_pointer(src->link, NULL);
spin_unlock(&src->link_lock);
diff --git a/drivers/hwtracing/stm/stm.h b/drivers/hwtracing/stm/stm.h
index cf33bf976a..95ece0292c 100644
--- a/drivers/hwtracing/stm/stm.h
+++ b/drivers/hwtracing/stm/stm.h
@@ -74,7 +74,7 @@ struct stm_source_device {
struct device dev;
struct stm_source_data *data;
spinlock_t link_lock;
- struct stm_device *link;
+ struct stm_device __rcu *link;
struct list_head link_entry;
/* one output per stm_source device */
struct stp_policy_node *policy_node;
--
2.5.3
next prev parent reply other threads:[~2015-10-06 9:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-06 9:47 [PATCH 0/2] stm/intel_th: Fix compilation warnings Alexander Shishkin
2015-10-06 9:47 ` Alexander Shishkin [this message]
2015-10-06 9:47 ` [PATCH 2/2] intel_th: Fix integer mismatch warnings Alexander Shishkin
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=1444124838-27049-2-git-send-email-alexander.shishkin@linux.intel.com \
--to=alexander.shishkin@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®