From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Michael Ellerman <mpe@ellerman.id.au>,
Anshuman Khandual <khandual@linux.vnet.ibm.com>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc/mm: Invalidate subpage_prot() system call on radix platforms
Date: Fri, 1 Dec 2017 16:02:52 +0530 [thread overview]
Message-ID: <0cb9d39f-f76c-dcc0-bbd4-b432baa1f8b4@linux.vnet.ibm.com> (raw)
In-Reply-To: <87r2sebuz2.fsf@concordia.ellerman.id.au>
On 12/01/2017 04:01 PM, Michael Ellerman wrote:
> Anshuman Khandual <khandual@linux.vnet.ibm.com> writes:
>
>> Radix enabled platforms don't support subpage_prot() system calls. But
>> at present the system calls goes through without an error and fails
>> later on while validating expected subpage accesses. Lets not allow
>> the system call on powerpc radix platforms to begin with to prevent
>> this confusion in user space.
>>
>> Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
>> ---
>> arch/powerpc/mm/subpage-prot.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/arch/powerpc/mm/subpage-prot.c b/arch/powerpc/mm/subpage-prot.c
>> index 781532d..4005468 100644
>> --- a/arch/powerpc/mm/subpage-prot.c
>> +++ b/arch/powerpc/mm/subpage-prot.c
>> @@ -195,6 +195,9 @@ long sys_subpage_prot(unsigned long addr, unsigned long len, u32 __user *map)
>> unsigned long next, limit;
>> int err;
>>
>> + if (radix_enabled())
>> + return -ENOSYS;
>
> It's considered poor form for syscalls to return ENOSYS. That is meant
> to mean one thing only, which is that the syscall does not exist.
>
> See:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/asm-generic/errno.h#n10
>
>
> Now arguably in this case ENOSYS does make some sense, because we'd
> really like it if the syscall didn't exist when radix is enabled.
>
> But I still don't like it, it means without changing the kernel version,
> the syscall would appear or disappear based on which MMU mode you booted
> into - which is weird.
>
> So I think ENOENT would be better. It says "the thing you're trying to
> access doesn't exist", where in this case "the thing" is "the subpage
> protection map for this address range". It's better than EINVAL because
> there's no implication that changing the arguments would result in
> different behaviour.
>
Why not ENOTSUPP?
-aneesh
prev parent reply other threads:[~2017-12-01 10:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-30 6:12 [PATCH] powerpc/mm: Invalidate subpage_prot() system call on radix platforms Anshuman Khandual
2017-12-01 10:31 ` Michael Ellerman
2017-12-01 10:32 ` Aneesh Kumar K.V [this message]
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=0cb9d39f-f76c-dcc0-bbd4-b432baa1f8b4@linux.vnet.ibm.com \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=khandual@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
/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).