linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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>,
	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>,
	rt-stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	John Kacur <jkacur-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
Subject: [PATCH RT 12/15] iommu/amd: Use raw_cpu_ptr() instead of get_cpu_ptr() for ->flush_queue
Date: Fri, 01 Dec 2017 10:48:49 -0500	[thread overview]
Message-ID: <20171201154913.211774599@goodmis.org> (raw)
In-Reply-To: 20171201154837.379265211@goodmis.org

[-- Attachment #1: 0012-iommu-amd-Use-raw_cpu_ptr-instead-of-get_cpu_ptr-for.patch --]
[-- Type: text/plain, Size: 1814 bytes --]

4.9.65-rt57-rc1 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: rt-stable-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

  parent reply	other threads:[~2017-12-01 15:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-01 15:48 [PATCH RT 00/15] Linux Steven Rostedt
2017-12-01 15:48 ` [PATCH RT 01/15] Revert "memcontrol: Prevent scheduling while atomic in cgroup code" Steven Rostedt
2017-12-01 15:48 ` [PATCH RT 02/15] Revert "fs: jbd2: pull your plug when waiting for space" Steven Rostedt
2017-12-01 15:48 ` [PATCH RT 03/15] rtmutex: Fix lock stealing logic Steven Rostedt
2017-12-01 15:48 ` [PATCH RT 04/15] posixtimer: init timer only with CONFIG_POSIX_TIMERS enabled Steven Rostedt
2017-12-01 15:48 ` [PATCH RT 05/15] cpu_pm: replace raw_notifier to atomic_notifier Steven Rostedt
2017-12-01 15:48 ` [PATCH RT 06/15] PM / CPU: replace raw_notifier with atomic_notifier (fixup) Steven Rostedt
2017-12-01 15:48 ` [PATCH RT 07/15] kernel/hrtimer: migrate deferred timer on CPU down Steven Rostedt
2017-12-01 15:48 ` [PATCH RT 08/15] net: take the tcp_sk_lock lock with BH disabled Steven Rostedt
2017-12-01 15:48 ` [PATCH RT 09/15] kernel/hrtimer: dont wakeup a process while holding the hrtimer base lock Steven Rostedt
2017-12-01 15:48 ` [PATCH RT 10/15] kernel/hrtimer/hotplug: dont wake ktimersoftd " Steven Rostedt
2017-12-01 15:48 ` [PATCH RT 11/15] Bluetooth: avoid recursive locking in hci_send_to_channel() Steven Rostedt
2017-12-01 15:48 ` Steven Rostedt [this message]
2017-12-01 15:48 ` [PATCH RT 13/15] rt/locking: allow recursive local_trylock() Steven Rostedt
2017-12-01 15:51 ` [PATCH RT 00/15] Linux Steven Rostedt
  -- strict thread matches above, loose matches on Subject: below --
2017-12-01 15:49 [PATCH RT 00/15] Linux 4.9.65-rt57-rc1 Steven Rostedt
2017-12-01 15:50 ` [PATCH RT 12/15] iommu/amd: Use raw_cpu_ptr() instead of get_cpu_ptr() for ->flush_queue 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=20171201154913.211774599@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=rt-stable-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).