linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* RE: Regarding select() on PPC
@ 2008-09-23  7:16 Sadashiiv, Halesh
  2008-09-23  9:07 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 38+ messages in thread
From: Sadashiiv, Halesh @ 2008-09-23  7:16 UTC (permalink / raw)
  To: benh, Arnd Bergmann; +Cc: linuxppc-embedded



>-----Original Message-----
>From: Benjamin Herrenschmidt [mailto:benh@kernel.crashing.org]
>Sent: Tuesday, September 23, 2008 12:00 PM
>To: Arnd Bergmann
>Cc: linuxppc-embedded@ozlabs.org; Sadashiiv, Halesh
>Subject: Re: Regarding select() on PPC
>
>On Tue, 2008-09-23 at 08:01 +0200, Arnd Bergmann wrote:
>> No, sorry, I don't have a git history that I can search for that.
>> I have a strong guess that it would be the end of the last century
>> though, probably before 2.3.48, since the comment in there already
>> refers to legacy binaries.
>
>Yeah, I'm keen to rip it out.

Means argument checking in ppc_select() can be removed??
Than shall I post patch to linuxppc-dev@ozlabs.org

>
>Ben.
>
>



-------------------------------------------------------------------
This email is confidential and intended only for the use of the =
individual or entity named above and may contain information that is =
privileged. If you are not the intended recipient, you are notified that =
any dissemination, distribution or copying of this email is strictly =
prohibited. If you have received this email in error, please notify us =
immediately by return email or telephone and destroy the original =
message. - This mail is sent via Sony Asia Pacific Mail Gateway.
-------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 38+ messages in thread
* RE: Regarding select() on PPC
@ 2008-09-23  9:31 Sadashiiv, Halesh
  0 siblings, 0 replies; 38+ messages in thread
From: Sadashiiv, Halesh @ 2008-09-23  9:31 UTC (permalink / raw)
  To: benh; +Cc: Arnd Bergmann, linuxppc-embedded



>-----Original Message-----
>From: Benjamin Herrenschmidt [mailto:benh@kernel.crashing.org]
>Sent: Tuesday, September 23, 2008 2:38 PM
>To: Sadashiiv, Halesh
>Cc: Arnd Bergmann; linuxppc-embedded@ozlabs.org
>Subject: RE: Regarding select() on PPC
>
>On Tue, 2008-09-23 at 12:46 +0530, Sadashiiv, Halesh wrote:
>>
>> >-----Original Message-----
>> >From: Benjamin Herrenschmidt [mailto:benh@kernel.crashing.org]
>> >Sent: Tuesday, September 23, 2008 12:00 PM
>> >To: Arnd Bergmann
>> >Cc: linuxppc-embedded@ozlabs.org; Sadashiiv, Halesh
>> >Subject: Re: Regarding select() on PPC
>> >
>> >On Tue, 2008-09-23 at 08:01 +0200, Arnd Bergmann wrote:
>> >> No, sorry, I don't have a git history that I can search for that.
>> >> I have a strong guess that it would be the end of the last century
>> >> though, probably before 2.3.48, since the comment in there already
>> >> refers to legacy binaries.
>> >
>> >Yeah, I'm keen to rip it out.
>>
>> Means argument checking in ppc_select() can be removed??
>> Than shall I post patch to linuxppc-dev@ozlabs.org
>
>ppc_select can probably be removed alltogether and ppc32_select too
>

Ok, directly sys_select() can be called instead of wrappers.

>Ben.
>
>

Halesh


-------------------------------------------------------------------
This email is confidential and intended only for the use of the =
individual or entity named above and may contain information that is =
privileged. If you are not the intended recipient, you are notified that =
any dissemination, distribution or copying of this email is strictly =
prohibited. If you have received this email in error, please notify us =
immediately by return email or telephone and destroy the original =
message. - This mail is sent via Sony Asia Pacific Mail Gateway.
-------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 38+ messages in thread
* RE: Regarding select() on PPC
@ 2008-09-23  5:27 Sadashiiv, Halesh
  0 siblings, 0 replies; 38+ messages in thread
From: Sadashiiv, Halesh @ 2008-09-23  5:27 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-embedded



>-----Original Message-----
>From: Benjamin Herrenschmidt [mailto:benh@kernel.crashing.org]
>Sent: Tuesday, September 23, 2008 10:41 AM
>To: Sadashiiv, Halesh
>Cc: Josh Boyer; linuxppc-embedded@ozlabs.org
>Subject: RE: Regarding select() on PPC
>
>
>> >Your patch should be submitted to the linuxppc-dev mailing list btw.
>> >
>>
>> Will do that.
>
>Don't bother for now. The right approach would be to just
>get rid of the wrappers I believe. I'm sorting that out.
>

Ok.Will wait, thanks a lot

>Ben.
>
>


Halesh


-------------------------------------------------------------------
This email is confidential and intended only for the use of the =
individual or entity named above and may contain information that is =
privileged. If you are not the intended recipient, you are notified that =
any dissemination, distribution or copying of this email is strictly =
prohibited. If you have received this email in error, please notify us =
immediately by return email or telephone and destroy the original =
message. - This mail is sent via Sony Asia Pacific Mail Gateway.
-------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 38+ messages in thread
* RE: Regarding select() on PPC
@ 2008-09-23  5:01 Sadashiiv, Halesh
  2008-09-23  5:11 ` Benjamin Herrenschmidt
  2008-09-23  5:46 ` Arnd Bergmann
  0 siblings, 2 replies; 38+ messages in thread
From: Sadashiiv, Halesh @ 2008-09-23  5:01 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-embedded


>-----Original Message-----
>From: Benjamin Herrenschmidt [mailto:benh@kernel.crashing.org]
>Sent: Tuesday, September 23, 2008 10:26 AM
>To: Sadashiiv, Halesh
>Cc: Josh Boyer; linuxppc-embedded@ozlabs.org
>Subject: RE: Regarding select() on PPC
>
>On Tue, 2008-09-23 at 10:20 +0530, Sadashiiv, Halesh wrote:
>> Hi,
>>
>> The below testcase requires to exit with setting errno as EINVAL, as
per
>> the man page.
>>
>> I tested this on ARM, I686, PPC64 it was fine, for the same on PPC32
it
>> used exit with errno set as EFAULT.
>>
>> On further investigation found there was some long obsolete code in
>> arch/powerpc/kernel/syscalls.c (function ppc_select()), which was
>> written in 2.2.0 kernel for PPC32 specific , which resulted in
EFAULT.
>>
>> This needs to be verified, I have proposed patch for PPC32, Please
check
>> the link
>> http://article.gmane.org/gmane.linux.kernel/735922
>>
>
>I'm trying to sort out how obsolete it actually is and see if we can
>remove the whole thing.
>

Ok...once you verified please let me know.


>Your patch should be submitted to the linuxppc-dev mailing list btw.
>

Will do that.

>Ben.
>
>

Thanks,
Halesh


-------------------------------------------------------------------
This email is confidential and intended only for the use of the =
individual or entity named above and may contain information that is =
privileged. If you are not the intended recipient, you are notified that =
any dissemination, distribution or copying of this email is strictly =
prohibited. If you have received this email in error, please notify us =
immediately by return email or telephone and destroy the original =
message. - This mail is sent via Sony Asia Pacific Mail Gateway.
-------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 38+ messages in thread
* RE: Regarding select() on PPC
@ 2008-09-23  4:50 Sadashiiv, Halesh
  2008-09-23  4:55 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 38+ messages in thread
From: Sadashiiv, Halesh @ 2008-09-23  4:50 UTC (permalink / raw)
  To: benh, Josh Boyer; +Cc: linuxppc-embedded


Hi,

The below testcase requires to exit with setting errno as EINVAL, as per
the man page.

I tested this on ARM, I686, PPC64 it was fine, for the same on PPC32 it
used exit with errno set as EFAULT.

On further investigation found there was some long obsolete code in
arch/powerpc/kernel/syscalls.c (function ppc_select()), which was
written in 2.2.0 kernel for PPC32 specific , which resulted in EFAULT.

This needs to be verified, I have proposed patch for PPC32, Please check
the link
http://article.gmane.org/gmane.linux.kernel/735922


Please find the below testcase.

#include <stdio.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include <stdlib.h>

int main()
{

 int fd;
 fd_set rfds;
 struct timeval tv;
 int ret_val;

 if ((fd =3D open("test_file", O_RDWR|O_CREAT, 0664)) < 0)
  {
    printf("Open failed\n");
  }

  FD_ZERO(&rfds);
  FD_SET(fd, &rfds);

  /* Wait up to five seconds. */
  tv.tv_sec =3D 1;
  tv.tv_usec =3D 0;

  if ( (ret_val =3D select(-1, &rfds, NULL, NULL, &tv)) < 0)
  {
    if ( errno =3D=3D EINVAL)
      printf("OK\n");
    else
      printf("Not OK, Got errno %d\n", errno);
  }
  exit(0);
}


Thanks,
Halesh



>-----Original Message-----
>From: Benjamin Herrenschmidt [mailto:benh@kernel.crashing.org]
>Sent: Tuesday, September 23, 2008 10:12 AM
>To: Josh Boyer
>Cc: Sadashiiv, Halesh; linuxppc-embedded@ozlabs.org
>Subject: Re: Regarding select() on PPC
>
>On Mon, 2008-09-22 at 11:24 -0400, Josh Boyer wrote:
>> On Mon, Sep 22, 2008 at 08:45:52PM +0530, Sadashiiv, Halesh wrote:
>> >
>> >
>> >The issue is found only in PPC32.
>> >
>> >Please let me if the patch is applicable.
>>
>> Well, no not really.  Mostly because of procedural issues than
anything
>> else.  Read Documentation/SubmittingPatches in the kernel directory.
>>
>> Also, there is a comment above this function that eludes to some
issues
>> with select on ppc32.  You might want to ask the overall PowerPC
>maintainer
>> if that issue still exits.
>
>I have only half of this thread, what is the problem ?
>
>Ben.
>
>



-------------------------------------------------------------------
This email is confidential and intended only for the use of the =
individual or entity named above and may contain information that is =
privileged. If you are not the intended recipient, you are notified that =
any dissemination, distribution or copying of this email is strictly =
prohibited. If you have received this email in error, please notify us =
immediately by return email or telephone and destroy the original =
message. - This mail is sent via Sony Asia Pacific Mail Gateway.
-------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 38+ messages in thread
* RE: Regarding select() on PPC
@ 2008-09-22 15:30 Sadashiiv, Halesh
  0 siblings, 0 replies; 38+ messages in thread
From: Sadashiiv, Halesh @ 2008-09-22 15:30 UTC (permalink / raw)
  To: Josh Boyer; +Cc: linuxppc-embedded


Thanks for the quick reply...

>-----Original Message-----
>From: Josh Boyer [mailto:jwboyer@gmail.com]
>Sent: Monday, September 22, 2008 8:55 PM
>To: Sadashiiv, Halesh
>Cc: linuxppc-embedded@ozlabs.org
>Subject: Re: Regarding select() on PPC
>
>On Mon, Sep 22, 2008 at 08:45:52PM +0530, Sadashiiv, Halesh wrote:
>>
>>
>>The issue is found only in PPC32.
>>
>>Please let me if the patch is applicable.
>
>Well, no not really.  Mostly because of procedural issues than anything
>else.  Read Documentation/SubmittingPatches in the kernel directory.

Will check the details.

>
>Also, there is a comment above this function that eludes to some issues
>with select on ppc32.  You might want to ask the overall PowerPC
maintainer
>if that issue still exits.

I have also posted in http://news.gmane.org/gmane.linux.kernel

http://article.gmane.org/gmane.linux.kernel/735618

Still no reply from any maintainer.

>
>josh


- Halesh



-------------------------------------------------------------------
This email is confidential and intended only for the use of the =
individual or entity named above and may contain information that is =
privileged. If you are not the intended recipient, you are notified that =
any dissemination, distribution or copying of this email is strictly =
prohibited. If you have received this email in error, please notify us =
immediately by return email or telephone and destroy the original =
message. - This mail is sent via Sony Asia Pacific Mail Gateway.
-------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 38+ messages in thread
* RE: Regarding select() on PPC
@ 2008-09-22 15:15 Sadashiiv, Halesh
  2008-09-22 15:24 ` Josh Boyer
  0 siblings, 1 reply; 38+ messages in thread
From: Sadashiiv, Halesh @ 2008-09-22 15:15 UTC (permalink / raw)
  To: Josh Boyer; +Cc: linuxppc-embedded



The issue is found only in PPC32.

Please let me if the patch is applicable.

+++ arch/powerpc/kernel/syscalls.c      2008-09-22 20:47:23.885126056
+0530
@@ -211,6 +211,9 @@
 int
 ppc_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set
__user *exp, struct timeval __user *tvp)
 {
+   if ( n < 0 )
+       return -EINVAL;
+
    if ( (unsigned long)n >=3D 4096 )
    {
        unsigned long __user *buffer =3D (unsigned long __user *)n;

Thanks,
Halesh


>-----Original Message-----
>From: Josh Boyer [mailto:jwboyer@gmail.com]
>Sent: Friday, September 19, 2008 7:49 PM
>To: Sadashiiv, Halesh
>Cc: linuxppc-embedded@ozlabs.org
>Subject: Re: Regarding select() on PPC
>
>On Fri, Sep 19, 2008 at 07:00:07PM +0530, Sadashiiv, Halesh wrote:
>>>For negetive value of n (first argument to select) select fails with
>>EINVAL
>>>error,
>>>
>>>But for the same when I tested for PowerPC it was giving EFAULT,
>>>Its on 2.6.16 kernel.
>
>2.6.16 is really old.  I tested your testcase on a 2.6.25 based kernel
on
>a ppc64 machine and it seemed to work fine.
>
>josh



-------------------------------------------------------------------
This email is confidential and intended only for the use of the =
individual or entity named above and may contain information that is =
privileged. If you are not the intended recipient, you are notified that =
any dissemination, distribution or copying of this email is strictly =
prohibited. If you have received this email in error, please notify us =
immediately by return email or telephone and destroy the original =
message. - This mail is sent via Sony Asia Pacific Mail Gateway.
-------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 38+ messages in thread
* RE: Regarding select() on PPC
@ 2008-09-19 14:28 Sadashiiv, Halesh
  0 siblings, 0 replies; 38+ messages in thread
From: Sadashiiv, Halesh @ 2008-09-19 14:28 UTC (permalink / raw)
  To: Josh Boyer; +Cc: linuxppc-embedded



>-----Original Message-----
>From: Josh Boyer [mailto:jwboyer@gmail.com]
>Sent: Friday, September 19, 2008 7:49 PM
>To: Sadashiiv, Halesh
>Cc: linuxppc-embedded@ozlabs.org
>Subject: Re: Regarding select() on PPC
>
>On Fri, Sep 19, 2008 at 07:00:07PM +0530, Sadashiiv, Halesh wrote:
>>>For negetive value of n (first argument to select) select fails with
>>EINVAL
>>>error,
>>>
>>>But for the same when I tested for PowerPC it was giving EFAULT,
>>>Its on 2.6.16 kernel.
>
>2.6.16 is really old.  I tested your testcase on a 2.6.25 based kernel
on
>a ppc64 machine and it seemed to work fine.
>
>josh


Thanks for the info,

I am using PPC32, I think it doest not matters on 2.6.16 as I manually
checked the select source with 2.6.23 and no changes seen.
&
Even the same testcase passes on MIPS32 with 2.6.16.

Thanks
Halesh




-------------------------------------------------------------------
This email is confidential and intended only for the use of the =
individual or entity named above and may contain information that is =
privileged. If you are not the intended recipient, you are notified that =
any dissemination, distribution or copying of this email is strictly =
prohibited. If you have received this email in error, please notify us =
immediately by return email or telephone and destroy the original =
message. - This mail is sent via Sony Asia Pacific Mail Gateway.
-------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 38+ messages in thread
* RE: Regarding select() on PPC
@ 2008-09-19 13:30 Sadashiiv, Halesh
  2008-09-19 14:19 ` Josh Boyer
  0 siblings, 1 reply; 38+ messages in thread
From: Sadashiiv, Halesh @ 2008-09-19 13:30 UTC (permalink / raw)
  To: linuxppc-embedded



>-----Original Message-----
>From: Sadashiiv, Halesh
>Sent: Friday, September 19, 2008 5:21 PM
>To: 'linuxppc-embedded@ozlabs.org'
>Subject: Regarding select() on PPC
>
>
>Hi all,
>
>Please find the below testcase.
>
>#include <stdio.h>
>#include <sys/time.h>
>#include <sys/types.h>
>#include <unistd.h>
>#include <fcntl.h>
>#include <string.h>
>#include <time.h>
>#include <errno.h>
>#include <stdlib.h>
>
>int main()
>{
>
> int fd;
> fd_set rfds;
> struct timeval tv;
> int ret_val;
>
> if ((fd =3D open("test_file", O_RDWR|O_CREAT, 0664)) < 0)
>  {
>    printf("Open failed\n");
>  }
>
>  FD_ZERO(&rfds);
>  FD_SET(fd, &rfds);
>
>  /* Wait up to five seconds. */
>  tv.tv_sec =3D 1;
>  tv.tv_usec =3D 0;
>
>  if ( (ret_val =3D select(-1, &rfds, NULL, NULL, &tv)) < 0)
>  {
>    if ( ret_val =3D=3D EINVAL)
=09
	if ( errno =3D=3D EINVAL)
Need to change it to errno, still not works.

>      printf("OK\n");
>    else
>      printf("Not OK, Got errno %d\n", errno);
>  }
>  exit(0);
>}
>
>
>For negetive value of n (first argument to select) select fails with
EINVAL
>error,
>
>But for the same when I tested for PowerPC it was giving EFAULT,
>Its on 2.6.16 kernel.
>
>Please let me know, If this is fixed or it's a issue in PPC.
>For other archs its working fine.
>
>
>Thanks,
>Halesh
>
>
>



-------------------------------------------------------------------
This email is confidential and intended only for the use of the =
individual or entity named above and may contain information that is =
privileged. If you are not the intended recipient, you are notified that =
any dissemination, distribution or copying of this email is strictly =
prohibited. If you have received this email in error, please notify us =
immediately by return email or telephone and destroy the original =
message. - This mail is sent via Sony Asia Pacific Mail Gateway.
-------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 38+ messages in thread
* Regarding select() on PPC
@ 2008-09-19 11:50 Sadashiiv, Halesh
  2008-09-19 14:53 ` Dale Farnsworth
  0 siblings, 1 reply; 38+ messages in thread
From: Sadashiiv, Halesh @ 2008-09-19 11:50 UTC (permalink / raw)
  To: linuxppc-embedded


Hi all,

Please find the below testcase.

#include <stdio.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include <stdlib.h>

int main()
{

 int fd;
 fd_set rfds;
 struct timeval tv;
 int ret_val;

 if ((fd =3D open("test_file", O_RDWR|O_CREAT, 0664)) < 0)
  {
    printf("Open failed\n");
  }

  FD_ZERO(&rfds);
  FD_SET(fd, &rfds);

  /* Wait up to five seconds. */
  tv.tv_sec =3D 1;
  tv.tv_usec =3D 0;

  if ( (ret_val =3D select(-1, &rfds, NULL, NULL, &tv)) < 0)
  {
    if ( ret_val =3D=3D EINVAL)
      printf("OK\n");
    else
      printf("Not OK, Got errno %d\n", errno);
  }
  exit(0);
}


For negetive value of n (first argument to select) select fails with
EINVAL error,

But for the same when I tested for PowerPC it was giving EFAULT,=20
Its on 2.6.16 kernel.

Please let me know, If this is fixed or it's a issue in PPC.
For other archs its working fine.


Thanks,
Halesh






-------------------------------------------------------------------
This email is confidential and intended only for the use of the =
individual or entity named above and may contain information that is =
privileged. If you are not the intended recipient, you are notified that =
any dissemination, distribution or copying of this email is strictly =
prohibited. If you have received this email in error, please notify us =
immediately by return email or telephone and destroy the original =
message. - This mail is sent via Sony Asia Pacific Mail Gateway.
-------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2008-10-13  2:42 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-23  7:16 Regarding select() on PPC Sadashiiv, Halesh
2008-09-23  9:07 ` Benjamin Herrenschmidt
2008-09-24  6:23   ` Arnd Bergmann
2008-09-24  6:28     ` Benjamin Herrenschmidt
2008-09-24  6:45       ` Arnd Bergmann
2008-09-24  7:08         ` Benjamin Herrenschmidt
2008-09-24 21:46           ` Benjamin Herrenschmidt
2008-09-24  6:39     ` [PATCH] remove bogus ppc_select syscall Arnd Bergmann
2008-09-24 16:29       ` Paul Mackerras
2008-09-24 17:03         ` Arnd Bergmann
2008-10-10  7:40           ` Paul Mackerras
2008-10-10  8:44             ` Arnd Bergmann
2008-10-10  4:29       ` Benjamin Herrenschmidt
2008-10-10  7:43         ` Paul Mackerras
2008-10-10  8:45           ` Arnd Bergmann
2008-10-10 23:17           ` Benjamin Herrenschmidt
2008-10-12  8:58             ` Arnd Bergmann
2008-10-13  2:42             ` i2o driver work with AMCC 460EX? Ayman El-Khashab
  -- strict thread matches above, loose matches on Subject: below --
2008-09-23  9:31 Regarding select() on PPC Sadashiiv, Halesh
2008-09-23  5:27 Sadashiiv, Halesh
2008-09-23  5:01 Sadashiiv, Halesh
2008-09-23  5:11 ` Benjamin Herrenschmidt
2008-09-23  5:46 ` Arnd Bergmann
2008-09-23  5:56   ` Benjamin Herrenschmidt
2008-09-23  6:01     ` Arnd Bergmann
2008-09-23  6:29       ` Benjamin Herrenschmidt
2008-09-23  4:50 Sadashiiv, Halesh
2008-09-23  4:55 ` Benjamin Herrenschmidt
2008-09-22 15:30 Sadashiiv, Halesh
2008-09-22 15:15 Sadashiiv, Halesh
2008-09-22 15:24 ` Josh Boyer
2008-09-23  4:42   ` Benjamin Herrenschmidt
2008-09-19 14:28 Sadashiiv, Halesh
2008-09-19 13:30 Sadashiiv, Halesh
2008-09-19 14:19 ` Josh Boyer
2008-09-19 11:50 Sadashiiv, Halesh
2008-09-19 14:53 ` Dale Farnsworth
2008-09-19 16:53   ` Dale Farnsworth

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).