* [PATCH] misc: sgi-gru: Don't disable preemption in GRU driver
@ 2024-09-19 12:34 Dimitri Sivanich
2024-10-09 19:49 ` Linus Torvalds
0 siblings, 1 reply; 3+ messages in thread
From: Dimitri Sivanich @ 2024-09-19 12:34 UTC (permalink / raw)
To: Linus Torvalds, Arnd Bergmann, Greg Kroah-Hartman, Dan Carpenter,
Lorenzo Stoakes
Cc: linux-mm, linux-kernel, Dimitri Sivanich
Disabling preemption in the GRU driver is unnecessary, and clashes with
sleeping locks in several code paths. Remove preempt_disable and
preempt_enable from the GRU driver.
Signed-off-by: Dimitri Sivanich <sivanich@hpe.com>
---
drivers/misc/sgi-gru/grukservices.c | 2 --
drivers/misc/sgi-gru/grumain.c | 4 ----
drivers/misc/sgi-gru/grutlbpurge.c | 2 --
3 files changed, 8 deletions(-)
diff --git a/drivers/misc/sgi-gru/grukservices.c b/drivers/misc/sgi-gru/grukservices.c
index 37e804bbb1f2..205945ce9e86 100644
--- a/drivers/misc/sgi-gru/grukservices.c
+++ b/drivers/misc/sgi-gru/grukservices.c
@@ -258,7 +258,6 @@ static int gru_get_cpu_resources(int dsr_bytes, void **cb, void **dsr)
int lcpu;
BUG_ON(dsr_bytes > GRU_NUM_KERNEL_DSR_BYTES);
- preempt_disable();
bs = gru_lock_kernel_context(-1);
lcpu = uv_blade_processor_id();
*cb = bs->kernel_cb + lcpu * GRU_HANDLE_STRIDE;
@@ -272,7 +271,6 @@ static int gru_get_cpu_resources(int dsr_bytes, void **cb, void **dsr)
static void gru_free_cpu_resources(void *cb, void *dsr)
{
gru_unlock_kernel_context(uv_numa_blade_id());
- preempt_enable();
}
/*
diff --git a/drivers/misc/sgi-gru/grumain.c b/drivers/misc/sgi-gru/grumain.c
index 0f5b09e290c8..3036c15f3689 100644
--- a/drivers/misc/sgi-gru/grumain.c
+++ b/drivers/misc/sgi-gru/grumain.c
@@ -937,10 +937,8 @@ vm_fault_t gru_fault(struct vm_fault *vmf)
again:
mutex_lock(>s->ts_ctxlock);
- preempt_disable();
if (gru_check_context_placement(gts)) {
- preempt_enable();
mutex_unlock(>s->ts_ctxlock);
gru_unload_context(gts, 1);
return VM_FAULT_NOPAGE;
@@ -949,7 +947,6 @@ vm_fault_t gru_fault(struct vm_fault *vmf)
if (!gts->ts_gru) {
STAT(load_user_context);
if (!gru_assign_gru_context(gts)) {
- preempt_enable();
mutex_unlock(>s->ts_ctxlock);
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(GRU_ASSIGN_DELAY); /* true hack ZZZ */
@@ -965,7 +962,6 @@ vm_fault_t gru_fault(struct vm_fault *vmf)
vma->vm_page_prot);
}
- preempt_enable();
mutex_unlock(>s->ts_ctxlock);
return VM_FAULT_NOPAGE;
diff --git a/drivers/misc/sgi-gru/grutlbpurge.c b/drivers/misc/sgi-gru/grutlbpurge.c
index 10921cd2608d..1107dd3e2e9f 100644
--- a/drivers/misc/sgi-gru/grutlbpurge.c
+++ b/drivers/misc/sgi-gru/grutlbpurge.c
@@ -65,7 +65,6 @@ static struct gru_tlb_global_handle *get_lock_tgh_handle(struct gru_state
struct gru_tlb_global_handle *tgh;
int n;
- preempt_disable();
if (uv_numa_blade_id() == gru->gs_blade_id)
n = get_on_blade_tgh(gru);
else
@@ -79,7 +78,6 @@ static struct gru_tlb_global_handle *get_lock_tgh_handle(struct gru_state
static void get_unlock_tgh_handle(struct gru_tlb_global_handle *tgh)
{
unlock_tgh_handle(tgh);
- preempt_enable();
}
/*
--
2.35.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] misc: sgi-gru: Don't disable preemption in GRU driver
2024-09-19 12:34 [PATCH] misc: sgi-gru: Don't disable preemption in GRU driver Dimitri Sivanich
@ 2024-10-09 19:49 ` Linus Torvalds
2024-10-10 7:55 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: Linus Torvalds @ 2024-10-09 19:49 UTC (permalink / raw)
To: Dimitri Sivanich
Cc: Arnd Bergmann, Greg Kroah-Hartman, Dan Carpenter, Lorenzo Stoakes,
linux-mm, linux-kernel
On Thu, 19 Sept 2024 at 06:16, Dimitri Sivanich <sivanich@hpe.com> wrote:
>
> Disabling preemption in the GRU driver is unnecessary, and clashes with
> sleeping locks in several code paths. Remove preempt_disable and
> preempt_enable from the GRU driver.
I've applied this directly, since it didn't come in through any of the
normal channels, and I don't see it pending anywhere in linux-next
either.
I doubt it matters much in practice, but at least it should make
smatch happier about this driver, and clearly the preemption disabling
was always wrong.
Linus
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] misc: sgi-gru: Don't disable preemption in GRU driver
2024-10-09 19:49 ` Linus Torvalds
@ 2024-10-10 7:55 ` Greg Kroah-Hartman
0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2024-10-10 7:55 UTC (permalink / raw)
To: Linus Torvalds
Cc: Dimitri Sivanich, Arnd Bergmann, Dan Carpenter, Lorenzo Stoakes,
linux-mm, linux-kernel
On Wed, Oct 09, 2024 at 12:49:23PM -0700, Linus Torvalds wrote:
> On Thu, 19 Sept 2024 at 06:16, Dimitri Sivanich <sivanich@hpe.com> wrote:
> >
> > Disabling preemption in the GRU driver is unnecessary, and clashes with
> > sleeping locks in several code paths. Remove preempt_disable and
> > preempt_enable from the GRU driver.
>
> I've applied this directly, since it didn't come in through any of the
> normal channels, and I don't see it pending anywhere in linux-next
> either.
No problem, I hadn't gotten to it yet in my large patch queue, thanks
for picking it up.
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-10 7:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-19 12:34 [PATCH] misc: sgi-gru: Don't disable preemption in GRU driver Dimitri Sivanich
2024-10-09 19:49 ` Linus Torvalds
2024-10-10 7:55 ` Greg Kroah-Hartman
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).