Skip to contentSkip to conversation

drivers/misc/sgi-gru: unapplied patches and a new one

PATCH In review Sudip Mukherjee 2 participants 12 messages Sep 21, 2015 – Oct 26, 2015 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

cover drivers/misc/sgi-gru: unapplied patches and a new one

Hi Dimitri,
I have taken these patches which were having ACK from you. Apart from these I saw another series of 25 patches from Jack Steiner <[email protected]> which will still apply almost cleanly but there was no ACK or review. Can you please have a look at: https://lkml.org/lkml/2010/7/19/289
or if you want I can take them and mail to you.

Hi Greg,
As discussed the first two are the old unapplied patches with maintainer ACK. I have mentioned the reference url individually in each patch for your verification. I have only considered those which are having maintainer ACK.
The last patch is a new one by me. There was another pending patch with maintainer ACK but that patch will not apply and is not relevant now. But the error which my new patch solves was found while checking that old patch.

Ohhh .. and there was also one more old patch from 2009, git log shows that also was not applied. Just guess who the submitter was ......

[email protected] :)

reference at: https://patchwork.kernel.org/patch/58189/

regards
sudip

Manuel Schölling (1):
sgi-gru: use time_before()

Rickard Strandqvist (1):
misc: sgi-gru: gruhandles.c: Remove unused function

Sudip Mukherjee (1):
drivers/misc/sgi-gru: fix return of error

 drivers/misc/sgi-gru/gruhandles.c  |  6 ------
 drivers/misc/sgi-gru/gruhandles.h  |  1 -
 drivers/misc/sgi-gru/grumain.c     |  4 +++-
 drivers/misc/sgi-gru/grutlbpurge.c | 20 ++++++++++----------
 4 files changed, 13 insertions(+), 18 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/3 sgi-gru: use time_before()

From: Manuel Schölling <[email protected]>

To be future-proof and for better readability the time comparisons are modified to use time_before() instead of plain, error-prone math.

---

reference at: https://patchwork.kernel.org/patch/4270701/

 drivers/misc/sgi-gru/grumain.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/misc/sgi-gru/grumain.c +3 -1
index ae16c8c..1525870 100644
@@ -930,6 +930,7 @@ int gru_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
 	struct gru_thread_state *gts;
 	unsigned long paddr, vaddr;
+	unsigned long expires;
 
 	vaddr = (unsigned long)vmf->virtual_address;
 	gru_dbg(grudev, "vma %p, vaddr 0x%lx (0x%lx)\n",
@@ -954,7 +955,8 @@ again:
 			mutex_unlock(&gts->ts_ctxlock);
 			set_current_state(TASK_INTERRUPTIBLE);
 			schedule_timeout(GRU_ASSIGN_DELAY);  /* true hack ZZZ */
-			if (gts->ts_steal_jiffies + GRU_STEAL_DELAY < jiffies)
+			expires = gts->ts_steal_jiffies + GRU_STEAL_DELAY;
+			if (time_before(expires, jiffies))
 				gru_steal_context(gts);
 			goto again;
 		}
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/3 misc: sgi-gru: gruhandles.c: Remove unused function

In reply to Sudip Mukherjee

From: Rickard Strandqvist <[email protected]>

Remove the function tfh_restart() that is not used anywhere.

This was partially found by using a static code analysis program called cppcheck.

---

reference at: https://patchwork.kernel.org/patch/5557141/

 drivers/misc/sgi-gru/gruhandles.c | 6 ------
 drivers/misc/sgi-gru/gruhandles.h | 1 -
 2 files changed, 7 deletions(-)
drivers/misc/sgi-gru/gruhandles.c +0 -6
index 2f30bad..1ee8e82 100644
@@ -196,12 +196,6 @@ void tfh_write_restart(struct gru_tlb_fault_handle *tfh,
 	start_instruction(tfh);
 }
 
-void tfh_restart(struct gru_tlb_fault_handle *tfh)
-{
-	tfh->opc = TFHOP_RESTART;
-	start_instruction(tfh);
-}
-
 void tfh_user_polling_mode(struct gru_tlb_fault_handle *tfh)
 {
 	tfh->opc = TFHOP_USER_POLLING_MODE;
drivers/misc/sgi-gru/gruhandles.h +0 -1
index 3f998b9..3d7bd36 100644
@@ -524,7 +524,6 @@ int tfh_write_only(struct gru_tlb_fault_handle *tfh, unsigned long paddr,
 	int gaa, unsigned long vaddr, int asid, int dirty, int pagesize);
 void tfh_write_restart(struct gru_tlb_fault_handle *tfh, unsigned long paddr,
 	int gaa, unsigned long vaddr, int asid, int dirty, int pagesize);
-void tfh_restart(struct gru_tlb_fault_handle *tfh);
 void tfh_user_polling_mode(struct gru_tlb_fault_handle *tfh);
 void tfh_exception(struct gru_tlb_fault_handle *tfh);
 
Signature · 1 line
1.9.1
#3 lore raw

PATCH 3/3 drivers/misc/sgi-gru: fix return of error

In reply to Sudip Mukherjee

If kzalloc() fails then gms is NULL and we are returning NULL, but the functions which called this function gru_register_mmu_notifier() are not expecting NULL as the return. They are expecting either a valid pointer or the error code in ERR_PTR.

---

The patch at https://patchwork.kernel.org/patch/6394911/ is not applied and not relevant now as gms is checked before gru_dbg. But the idea for this patch was obtained from that one.

 drivers/misc/sgi-gru/grutlbpurge.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/misc/sgi-gru/grutlbpurge.c +10 -10
index 757a8e9..e936d43 100644
@@ -306,16 +306,16 @@ struct gru_mm_struct *gru_register_mmu_notifier(void)
 		atomic_inc(&gms->ms_refcnt);
 	} else {
 		gms = kzalloc(sizeof(*gms), GFP_KERNEL);
-		if (gms) {
-			STAT(gms_alloc);
-			spin_lock_init(&gms->ms_asid_lock);
-			gms->ms_notifier.ops = &gru_mmuops;
-			atomic_set(&gms->ms_refcnt, 1);
-			init_waitqueue_head(&gms->ms_wait_queue);
-			err = __mmu_notifier_register(&gms->ms_notifier, current->mm);
-			if (err)
-				goto error;
-		}
+		if (!gms)
+			return ERR_PTR(-ENOMEM);
+		STAT(gms_alloc);
+		spin_lock_init(&gms->ms_asid_lock);
+		gms->ms_notifier.ops = &gru_mmuops;
+		atomic_set(&gms->ms_refcnt, 1);
+		init_waitqueue_head(&gms->ms_wait_queue);
+		err = __mmu_notifier_register(&gms->ms_notifier, current->mm);
+		if (err)
+			goto error;
 	}
 	if (gms)
 		gru_dbg(grudev, "gms %p, refcnt %d\n", gms,
Signature · 1 line
1.9.1
Acked-by on v1 3/3
#4 lore raw

Re: [PATCH 3/3] drivers/misc/sgi-gru: fix return of error

Quoted 48 lines · Sudip Mukherjee

If kzalloc() fails then gms is NULL and we are returning NULL, but the functions which called this function gru_register_mmu_notifier() are not expecting NULL as the return. They are expecting either a valid pointer or the error code in ERR_PTR.

---

The patch at https://patchwork.kernel.org/patch/6394911/ is not applied and not relevant now as gms is checked before gru_dbg. But the idea for this patch was obtained from that one.

 drivers/misc/sgi-gru/grutlbpurge.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/misc/sgi-gru/grutlbpurge.c +10 -10
index 757a8e9..e936d43 100644
@@ -306,16 +306,16 @@ struct gru_mm_struct *gru_register_mmu_notifier(void)
 		atomic_inc(&gms->ms_refcnt);
 	} else {
 		gms = kzalloc(sizeof(*gms), GFP_KERNEL);
-		if (gms) {
-			STAT(gms_alloc);
-			spin_lock_init(&gms->ms_asid_lock);
-			gms->ms_notifier.ops = &gru_mmuops;
-			atomic_set(&gms->ms_refcnt, 1);
-			init_waitqueue_head(&gms->ms_wait_queue);
-			err = __mmu_notifier_register(&gms->ms_notifier, current->mm);
-			if (err)
-				goto error;
-		}
+		if (!gms)
+			return ERR_PTR(-ENOMEM);
+		STAT(gms_alloc);
+		spin_lock_init(&gms->ms_asid_lock);
+		gms->ms_notifier.ops = &gru_mmuops;
+		atomic_set(&gms->ms_refcnt, 1);
+		init_waitqueue_head(&gms->ms_wait_queue);
+		err = __mmu_notifier_register(&gms->ms_notifier, current->mm);
+		if (err)
+			goto error;
 	}
 	if (gms)
 		gru_dbg(grudev, "gms %p, refcnt %d\n", gms,
Signature · 1 line
1.9.1
#5 lore raw
In reply to Sudip Mukherjee

Sudip,

I can take a look at the Jack Steiner patches. Was there anything in the set of 3 patches that you sent that still needs a review?

Quoted 44 lines · Sudip Mukherjee

Hi Dimitri,
I have taken these patches which were having ACK from you. Apart from these I saw another series of 25 patches from Jack Steiner <[email protected]> which will still apply almost cleanly but there was no ACK or review. Can you please have a look at: https://lkml.org/lkml/2010/7/19/289
or if you want I can take them and mail to you.

Hi Greg,
As discussed the first two are the old unapplied patches with maintainer ACK. I have mentioned the reference url individually in each patch for your verification. I have only considered those which are having maintainer ACK.
The last patch is a new one by me. There was another pending patch with maintainer ACK but that patch will not apply and is not relevant now. But the error which my new patch solves was found while checking that old patch.

Ohhh .. and there was also one more old patch from 2009, git log shows that also was not applied. Just guess who the submitter was ......

[email protected] :)

reference at: https://patchwork.kernel.org/patch/58189/

regards
sudip

Manuel Schölling (1):
sgi-gru: use time_before()

Rickard Strandqvist (1):
misc: sgi-gru: gruhandles.c: Remove unused function

Sudip Mukherjee (1):
drivers/misc/sgi-gru: fix return of error

 drivers/misc/sgi-gru/gruhandles.c  |  6 ------
 drivers/misc/sgi-gru/gruhandles.h  |  1 -
 drivers/misc/sgi-gru/grumain.c     |  4 +++-
 drivers/misc/sgi-gru/grutlbpurge.c | 20 ++++++++++----------
 4 files changed, 13 insertions(+), 18 deletions(-)
Signature · 1 line
1.9.1
#6 lore raw
Quoted 4 lines · Dimitri Sivanich

Sudip,

I can take a look at the Jack Steiner patches. Was there anything in the set of 3 patches that you sent that still needs a review?

Yes. The 3/3 patch please. That one is new. I found that problem while checking another old patch.
If Jack Steiner patches looks ok then you can send the series to Greg or if you want me to send please do let me know.

regards
sudip

#7 lore raw
Quoted 9 lines · Sudip Mukherjee
Quoted 4 lines · Dimitri Sivanich

Sudip,

I can take a look at the Jack Steiner patches. Was there anything in the set of 3 patches that you sent that still needs a review?

Yes. The 3/3 patch please. That one is new. I found that problem while checking another old patch.
If Jack Steiner patches looks ok then you can send the series to Greg or if you want me to send please do let me know.

Hi Dimitri,
Greg has picked up this series. Did you have a chance to look at the series of Jack Steiner or shall i repost for your review?

regards
sudip

#8 lore raw
Quoted 6 lines · Sudip Mukherjee
Quoted 5 lines · Sudip Mukherjee
Quoted 4 lines · Dimitri Sivanich

Sudip,

I can take a look at the Jack Steiner patches. Was there anything in the set of 3 patches that you sent that still needs a review?

Quoted 9 lines
Quoted 4 lines

Yes. The 3/3 patch please. That one is new. I found that problem while checking another old patch.
If Jack Steiner patches looks ok then you can send the series to Greg or if you want me to send please do let me know.

Hi Dimitri,
Greg has picked up this series. Did you have a chance to look at the series of Jack Steiner or shall i repost for your review?

I haven't had a chance to fully review those yet.

#9 lore raw
Quoted 12 lines · Dimitri Sivanich
Quoted 11 lines · Sudip Mukherjee
Quoted 9 lines · Sudip Mukherjee
Quoted 4 lines · Dimitri Sivanich

Sudip,

I can take a look at the Jack Steiner patches. Was there anything in the set of 3 patches that you sent that still needs a review?

Yes. The 3/3 patch please. That one is new. I found that problem while checking another old patch.
If Jack Steiner patches looks ok then you can send the series to Greg or if you want me to send please do let me know.

Quoted 5 lines
Quoted 4 lines

Hi Dimitri,
Greg has picked up this series. Did you have a chance to look at the series of Jack Steiner or shall i repost for your review?

I haven't had a chance to fully review those yet.

Hi Dimitri,
will it help if I repost them as patch? I understand it will be difficult to review patches in webpage from where you can not apply and test. Please do let me know if i can be of any help.

regards
sudip

#10 lore raw
Quoted 17 lines · Sudip Mukherjee
Quoted 16 lines · Dimitri Sivanich
Quoted 15 lines · Sudip Mukherjee
Quoted 9 lines · Sudip Mukherjee
Quoted 4 lines · Dimitri Sivanich

Sudip,

I can take a look at the Jack Steiner patches. Was there anything in the set of 3 patches that you sent that still needs a review?

Yes. The 3/3 patch please. That one is new. I found that problem while checking another old patch.
If Jack Steiner patches looks ok then you can send the series to Greg or if you want me to send please do let me know.

Hi Dimitri,
Greg has picked up this series. Did you have a chance to look at the series of Jack Steiner or shall i repost for your review?

Quoted 7 lines
Quoted 1 line

I haven't had a chance to fully review those yet.

Hi Dimitri,
will it help if I repost them as patch? I understand it will be difficult to review patches in webpage from where you can not apply and test. Please do let me know if i can be of any help.

Go ahead and send as a patch (or patches?).

#11 lore raw
Quoted 18 lines · Dimitri Sivanich
Quoted 17 lines · Sudip Mukherjee
Quoted 16 lines · Dimitri Sivanich
Quoted 15 lines · Sudip Mukherjee
Quoted 9 lines · Sudip Mukherjee
Quoted 4 lines · Dimitri Sivanich

Sudip,

I can take a look at the Jack Steiner patches. Was there anything in the set of 3 patches that you sent that still needs a review?

Yes. The 3/3 patch please. That one is new. I found that problem while checking another old patch.
If Jack Steiner patches looks ok then you can send the series to Greg or if you want me to send please do let me know.

Hi Dimitri,
Greg has picked up this series. Did you have a chance to look at the series of Jack Steiner or shall i repost for your review?

Quoted 8 lines
Quoted 7 lines
Quoted 1 line

I haven't had a chance to fully review those yet.

Hi Dimitri,
will it help if I repost them as patch? I understand it will be difficult to review patches in webpage from where you can not apply and test. Please do let me know if i can be of any help.

Go ahead and send as a patch (or patches?).

Sorry for the delay in reply, was on my annual leave. I will send them tomorrow.

regards
sudip