linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	mikey@neuling.org, hbabu@us.ibm.com, nicholas.piggin@gmail.com,
	linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 13/18] powerpc: Add support for setting SPRN_TIDR
Date: Thu, 09 Nov 2017 22:53:04 +1100	[thread overview]
Message-ID: <87bmkbpt27.fsf@concordia.ellerman.id.au> (raw)
In-Reply-To: <1510107838-15181-14-git-send-email-sukadev@linux.vnet.ibm.com>

Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> writes:

> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
> index 37ed60b..d861fcd 100644
> --- a/arch/powerpc/kernel/process.c
> +++ b/arch/powerpc/kernel/process.c
> @@ -1120,6 +1120,13 @@ static inline void restore_sprs(struct thread_struct *old_thread,
>  			mtspr(SPRN_TAR, new_thread->tar);
>  	}
>  #endif
> +#ifdef CONFIG_PPC64
> +	if (old_thread->tidr != new_thread->tidr) {
> +		/* TIDR should be non-zero only with ISA3.0. */
> +		WARN_ON_ONCE(!cpu_has_feature(CPU_FTR_ARCH_300));

This is silly, just make the whole block depend on CPU_FTR_ARCH_300.

I've fixed it up.

> @@ -1466,6 +1581,10 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
>  
>  	clear_task_ebb(dst);
>  
> +#ifdef CONFIG_PPC64
> +	dst->thread.tidr = 0;
> +#endif
> +
>  	return 0;
>  }

This is called from clone().


> @@ -1576,6 +1695,9 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
>  #endif
>  
>  	setup_ksp_vsid(p, sp);
> +#ifdef CONFIG_PPC64
> +	p->thread.tidr = 0;
> +#endif
  
And so is this.

So I think you only need the latter.

That does mean you're clearing the TIDR on fork(), but not exec().

Typically you'd do the reverse, ie. clear it on exec() but leave it the
same on fork().

Because this is a "thread id" I think it does make sense to clear it on
fork(), otherwise you potentially have two processes with the same id
and only one of them will be woken up by the AS_notify.

So I'll drop the clear from arch_dup_task_struct().

cheers

  reply	other threads:[~2017-11-09 11:53 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-08  2:23 [PATCH v3 00/18] powerpc/vas: Add support for FTW Sukadev Bhattiprolu
2017-11-08  2:23 ` [PATCH v3 01/18] powerpc/vas: init missing fields from [rt]xattr Sukadev Bhattiprolu
2017-11-14 11:12   ` [v3,01/18] " Michael Ellerman
2017-11-08  2:23 ` [PATCH v3 02/18] powerpc/vas: Validate window credits Sukadev Bhattiprolu
2017-11-08  2:23 ` [PATCH v3 03/18] powerpc/vas: Cleanup some debug code Sukadev Bhattiprolu
2017-11-08  2:23 ` [PATCH v3 04/18] powerpc/vas: Drop poll_window_cast_out() Sukadev Bhattiprolu
2017-11-08  2:23 ` [PATCH v3 05/18] powerpc/vas: Use helper to unpin/close window Sukadev Bhattiprolu
2017-11-08  2:23 ` [PATCH v3 06/18] powerpc/vas: Reduce polling interval for busy state Sukadev Bhattiprolu
2017-11-08  2:23 ` [PATCH v3 07/18] powerpc/vas: Save configured window credits Sukadev Bhattiprolu
2017-11-08  2:23 ` [PATCH v3 08/18] powerpc/vas: poll for return of " Sukadev Bhattiprolu
2017-11-08  2:23 ` [PATCH v3 09/18] powerpc/vas: Create cpu to vas id mapping Sukadev Bhattiprolu
2017-11-08  2:23 ` [PATCH v3 10/18] powerpc/vas, nx-842: Define and use chip_to_vas_id() Sukadev Bhattiprolu
2017-11-20 17:57   ` Josh Boyer
2017-11-22 11:56     ` Michael Ellerman
2017-11-08  2:23 ` [PATCH v3 11/18] powerpc/vas: Export HVWC to debugfs Sukadev Bhattiprolu
2017-11-08  2:23 ` [PATCH v3 12/18] powerpc: have copy depend on CONFIG_BOOK3S_64 Sukadev Bhattiprolu
2017-11-08  2:23 ` [PATCH v3 13/18] powerpc: Add support for setting SPRN_TIDR Sukadev Bhattiprolu
2017-11-09 11:53   ` Michael Ellerman [this message]
2017-11-08  2:23 ` [PATCH v3 14/18] powerpc: Define set_thread_uses_vas() Sukadev Bhattiprolu
2017-11-08  2:23 ` [PATCH v3 15/18] powerpc: Emulate paste instruction Sukadev Bhattiprolu
2017-11-08  2:23 ` [PATCH v3 16/18] powerpc/vas: Define vas_win_paste_addr() Sukadev Bhattiprolu
2017-11-08  2:23 ` [PATCH v3 17/18] powerpc/vas: Define vas_win_id() Sukadev Bhattiprolu
2017-11-08  2:23 ` [PATCH v3 18/18] powerpc/vas: Add support for user receive window Sukadev Bhattiprolu

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=87bmkbpt27.fsf@concordia.ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=benh@kernel.crashing.org \
    --cc=hbabu@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mikey@neuling.org \
    --cc=nicholas.piggin@gmail.com \
    --cc=sukadev@linux.vnet.ibm.com \
    /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).