All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>,
	linuxppc-dev@lists.ozlabs.org,
	Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>,
	Christophe Lombard <christophe_lombard@fr.ibm.com>,
	Philippe Bergheaud <philippe.bergheaud@fr.ibm.com>
Cc: Andrew Donnellan <andrew.donnellan@au1.ibm.com>,
	Alastair D'Silva <alastair@linux.ibm.com>,
	Frederic Barrat <fbarrat@linux.vnet.ibm.com>
Subject: Re: [PATCH 1/2] powerpc: Avoid signed to unsigned conversion in set_thread_tidr()
Date: Mon, 27 Nov 2017 14:44:02 +1100	[thread overview]
Message-ID: <87609w4c8t.fsf@concordia.ellerman.id.au> (raw)
In-Reply-To: <87fu94f925.fsf@vajain21.in.ibm.com>

Vaibhav Jain <vaibhav@linux.vnet.ibm.com> writes:

> Thanks Mpe for reviewing the patch
>
> Michael Ellerman <mpe@ellerman.id.au> writes:
>
>>> To fix this the patch assigns the return value of assign_thread_tidr()
>>> to a temporary int and assigns it to thread.tidr iff its '> 0'.
>>
>> .. and changes the calling convention of the function.
>>
>> Now it returns -ve error values, or a +ve TIDR value when it succeeds,
>> or possibly 0 if that's returned by assign_thread_tidr().
>>
>> Which I'm not sure you meant to do. If you did, you should at least
>> document it.
>
> Yes this is intentional and this was supposed to be the calling
> convention of set_thread_tidr() in first place. At-least that what I
> gather from subsequent cxl patch to add its support
> http://patchwork.ozlabs.org/patch/840719/

That's not at all what I gather from that patch.

+		/* Assign a unique TIDR (thread id) for the current thread */
+		rc = set_thread_tidr(current);
+		if (!rc)
+			ctx->tid = current->thread.tidr;

That expects 0 on success, anything else is an error.

Which is what set_thread_tidr() currently implements, and is the most
common calling convention in kernel code.

Please don't change that as part of an unrelated fix.

If you want to change the calling convention, send a patch to do that
and only that.

cheers

  reply	other threads:[~2017-11-27  3:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-23 12:47 [PATCH 1/2] powerpc: Avoid signed to unsigned conversion in set_thread_tidr() Vaibhav Jain
2017-11-23 12:47 ` [PATCH 2/2] powerpc: Do not assign thread.tidr if already assigned Vaibhav Jain
2017-11-24  6:17 ` [PATCH 1/2] powerpc: Avoid signed to unsigned conversion in set_thread_tidr() Michael Ellerman
2017-11-24  7:08   ` Vaibhav Jain
2017-11-27  3:44     ` Michael Ellerman [this message]
2017-11-27 17:05       ` Vaibhav Jain

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=87609w4c8t.fsf@concordia.ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=alastair@linux.ibm.com \
    --cc=andrew.donnellan@au1.ibm.com \
    --cc=christophe_lombard@fr.ibm.com \
    --cc=fbarrat@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=philippe.bergheaud@fr.ibm.com \
    --cc=sukadev@linux.vnet.ibm.com \
    --cc=vaibhav@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 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.