From: Steven Rostedt <rostedt-nx8X9YLhiw1AfugRpC6u6w@public.gmane.org>
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-rt-users
<linux-rt-users-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: tom.zanussi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
Daniel Wagner
<daniel.wagner-kv7WeFo6aLtBDgjK7y7TUQ@public.gmane.org>,
Julia Cartwright <julia-acOepvfBmUk@public.gmane.org>,
stable-rt-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Sebastian Andrzej Siewior
<bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
Vinod Adhikary <vinadhy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Carsten Emde <C.Emde-Q945KHDl0DbYtjvyW6yDsg@public.gmane.org>,
Paul Gortmaker
<paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
Alex Shi <alex.shi-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
John Kacur <jkacur-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
Subject: [PATCH RT 11/15] iommu/amd: Use raw_cpu_ptr() instead of get_cpu_ptr() for ->flush_queue
Date: Fri, 01 Dec 2017 19:02:00 -0500 [thread overview]
Message-ID: <20171202000428.386884117@goodmis.org> (raw)
In-Reply-To: 20171202000149.842718953@goodmis.org
[-- Attachment #1: 0011-iommu-amd-Use-raw_cpu_ptr-instead-of-get_cpu_ptr-for.patch --]
[-- Type: text/plain, Size: 1814 bytes --]
4.9.65-rt57-rc2 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
get_cpu_ptr() disabled preemption and returns the ->flush_queue object
of the current CPU. raw_cpu_ptr() does the same except that it not
disable preemption which means the scheduler can move it to another CPU
after it obtained the per-CPU object.
In this case this is not bad because the data structure itself is
protected with a spin_lock. This change shouldn't matter however on RT
it does because the sleeping lock can't be accessed with disabled
preemption.
Cc: stable-rt-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Reported-by: Vinod Adhikary <vinadhy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
---
drivers/iommu/amd_iommu.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index a88595b21111..ff5c2424eb9e 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -2283,7 +2283,7 @@ static void queue_add(struct dma_ops_domain *dma_dom,
pages = __roundup_pow_of_two(pages);
address >>= PAGE_SHIFT;
- queue = get_cpu_ptr(&flush_queue);
+ queue = raw_cpu_ptr(&flush_queue);
spin_lock_irqsave(&queue->lock, flags);
if (queue->next == FLUSH_QUEUE_SIZE)
@@ -2300,8 +2300,6 @@ static void queue_add(struct dma_ops_domain *dma_dom,
if (atomic_cmpxchg(&queue_timer_on, 0, 1) == 0)
mod_timer(&queue_timer, jiffies + msecs_to_jiffies(10));
-
- put_cpu_ptr(&flush_queue);
}
--
2.13.2
WARNING: multiple messages have this Message-ID (diff)
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org,
linux-rt-users <linux-rt-users@vger.kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Carsten Emde <C.Emde@osadl.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
John Kacur <jkacur@redhat.com>,
Paul Gortmaker <paul.gortmaker@windriver.com>,
Julia Cartwright <julia@ni.com>,
Daniel Wagner <daniel.wagner@siemens.com>,
tom.zanussi@linux.intel.com, Alex Shi <alex.shi@linaro.org>,
stable-rt@vger.kernel.org, Joerg Roedel <joro@8bytes.org>,
iommu@lists.linux-foundation.org,
Vinod Adhikary <vinadhy@gmail.com>
Subject: [PATCH RT 11/15] iommu/amd: Use raw_cpu_ptr() instead of get_cpu_ptr() for ->flush_queue
Date: Fri, 01 Dec 2017 19:02:00 -0500 [thread overview]
Message-ID: <20171202000428.386884117@goodmis.org> (raw)
In-Reply-To: 20171202000149.842718953@goodmis.org
[-- Attachment #1: 0011-iommu-amd-Use-raw_cpu_ptr-instead-of-get_cpu_ptr-for.patch --]
[-- Type: text/plain, Size: 1645 bytes --]
4.9.65-rt57-rc2 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
get_cpu_ptr() disabled preemption and returns the ->flush_queue object
of the current CPU. raw_cpu_ptr() does the same except that it not
disable preemption which means the scheduler can move it to another CPU
after it obtained the per-CPU object.
In this case this is not bad because the data structure itself is
protected with a spin_lock. This change shouldn't matter however on RT
it does because the sleeping lock can't be accessed with disabled
preemption.
Cc: stable-rt@vger.kernel.org
Cc: Joerg Roedel <joro@8bytes.org>
Cc: iommu@lists.linux-foundation.org
Reported-by: Vinod Adhikary <vinadhy@gmail.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
drivers/iommu/amd_iommu.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index a88595b21111..ff5c2424eb9e 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -2283,7 +2283,7 @@ static void queue_add(struct dma_ops_domain *dma_dom,
pages = __roundup_pow_of_two(pages);
address >>= PAGE_SHIFT;
- queue = get_cpu_ptr(&flush_queue);
+ queue = raw_cpu_ptr(&flush_queue);
spin_lock_irqsave(&queue->lock, flags);
if (queue->next == FLUSH_QUEUE_SIZE)
@@ -2300,8 +2300,6 @@ static void queue_add(struct dma_ops_domain *dma_dom,
if (atomic_cmpxchg(&queue_timer_on, 0, 1) == 0)
mod_timer(&queue_timer, jiffies + msecs_to_jiffies(10));
-
- put_cpu_ptr(&flush_queue);
}
--
2.13.2
next prev parent reply other threads:[~2017-12-02 0:02 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-02 0:01 [PATCH RT 00/15] Linux 4.9.65-rt57-rc2 Steven Rostedt
2017-12-02 0:01 ` [PATCH RT 01/15] Revert "memcontrol: Prevent scheduling while atomic in cgroup code" Steven Rostedt
2017-12-02 0:01 ` [PATCH RT 02/15] Revert "fs: jbd2: pull your plug when waiting for space" Steven Rostedt
2017-12-04 8:37 ` Sebastian Andrzej Siewior
2017-12-08 18:13 ` Steven Rostedt
2017-12-02 0:01 ` [PATCH RT 03/15] rtmutex: Fix lock stealing logic Steven Rostedt
2017-12-02 0:01 ` [PATCH RT 04/15] cpu_pm: replace raw_notifier to atomic_notifier Steven Rostedt
2017-12-02 0:01 ` [PATCH RT 05/15] PM / CPU: replace raw_notifier with atomic_notifier (fixup) Steven Rostedt
2017-12-02 0:01 ` [PATCH RT 06/15] kernel/hrtimer: migrate deferred timer on CPU down Steven Rostedt
2017-12-02 0:01 ` [PATCH RT 07/15] net: take the tcp_sk_lock lock with BH disabled Steven Rostedt
2017-12-02 0:01 ` [PATCH RT 08/15] kernel/hrtimer: dont wakeup a process while holding the hrtimer base lock Steven Rostedt
2017-12-02 0:01 ` [PATCH RT 09/15] kernel/hrtimer/hotplug: dont wake ktimersoftd " Steven Rostedt
2017-12-02 0:01 ` [PATCH RT 10/15] Bluetooth: avoid recursive locking in hci_send_to_channel() Steven Rostedt
2017-12-02 0:02 ` Steven Rostedt [this message]
2017-12-02 0:02 ` [PATCH RT 11/15] iommu/amd: Use raw_cpu_ptr() instead of get_cpu_ptr() for ->flush_queue Steven Rostedt
2017-12-02 0:02 ` [PATCH RT 12/15] rt/locking: allow recursive local_trylock() Steven Rostedt
2017-12-02 0:02 ` [PATCH RT 13/15] locking/rtmutex: dont drop the wait_lock twice Steven Rostedt
2017-12-02 0:02 ` [PATCH RT 14/15] net: use trylock in icmp_sk Steven Rostedt
2017-12-02 0:02 ` [PATCH RT 15/15] Linux 4.9.65-rt57-rc2 Steven Rostedt
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=20171202000428.386884117@goodmis.org \
--to=rostedt-nx8x9ylhiw1afugrpc6u6w@public.gmane.org \
--cc=C.Emde-Q945KHDl0DbYtjvyW6yDsg@public.gmane.org \
--cc=alex.shi-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
--cc=daniel.wagner-kv7WeFo6aLtBDgjK7y7TUQ@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=jkacur-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=julia-acOepvfBmUk@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-rt-users-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org \
--cc=stable-rt-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
--cc=tom.zanussi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=vinadhy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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.