Re: [PATCH tty-next 5/7] n_tty: Refactor input_available_p() by call site

2013-11-24 Thread One Thousand Gnomes
On Sat, 23 Nov 2013 21:01:56 -0500
Peter Hurley  wrote:

> On 11/23/2013 07:26 PM, One Thousand Gnomes wrote:
> > On Fri, 22 Nov 2013 10:59:23 -0500
> > Peter Hurley  wrote:
> >
> >> Distinguish if caller is n_tty_poll() or n_tty_read(), and
> >> set the read/wakeup threshold accordingly.
> >>
> >> Signed-off-by: Peter Hurley 
> >
> > Doh ignore previous.. yes that patch is right.  I should pay attention to
> > 0/7 8)
> 
> Maybe I should add more to the commit message from the cover letter
> description ?

Maybe I should just read the code more carefully 8).

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH tty-next 5/7] n_tty: Refactor input_available_p() by call site

2013-11-24 Thread One Thousand Gnomes
On Sat, 23 Nov 2013 21:01:56 -0500
Peter Hurley pe...@hurleysoftware.com wrote:

 On 11/23/2013 07:26 PM, One Thousand Gnomes wrote:
  On Fri, 22 Nov 2013 10:59:23 -0500
  Peter Hurley pe...@hurleysoftware.com wrote:
 
  Distinguish if caller is n_tty_poll() or n_tty_read(), and
  set the read/wakeup threshold accordingly.
 
  Signed-off-by: Peter Hurley pe...@hurleysoftware.com
 
  Doh ignore previous.. yes that patch is right.  I should pay attention to
  0/7 8)
 
 Maybe I should add more to the commit message from the cover letter
 description ?

Maybe I should just read the code more carefully 8).

Alan
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH tty-next 5/7] n_tty: Refactor input_available_p() by call site

2013-11-23 Thread Peter Hurley

On 11/23/2013 07:26 PM, One Thousand Gnomes wrote:

On Fri, 22 Nov 2013 10:59:23 -0500
Peter Hurley  wrote:


Distinguish if caller is n_tty_poll() or n_tty_read(), and
set the read/wakeup threshold accordingly.

Signed-off-by: Peter Hurley 


Doh ignore previous.. yes that patch is right.  I should pay attention to
0/7 8)


Maybe I should add more to the commit message from the cover letter
description ?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH tty-next 5/7] n_tty: Refactor input_available_p() by call site

2013-11-23 Thread One Thousand Gnomes
On Fri, 22 Nov 2013 10:59:23 -0500
Peter Hurley  wrote:

> Distinguish if caller is n_tty_poll() or n_tty_read(), and
> set the read/wakeup threshold accordingly.
> 
> Signed-off-by: Peter Hurley 

Doh ignore previous.. yes that patch is right.  I should pay attention to
0/7 8)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH tty-next 5/7] n_tty: Refactor input_available_p() by call site

2013-11-23 Thread One Thousand Gnomes
On Fri, 22 Nov 2013 10:59:23 -0500
Peter Hurley  wrote:

> Distinguish if caller is n_tty_poll() or n_tty_read(), and
> set the read/wakeup threshold accordingly.

That looks very wrong to me. The poll() and read() wakeup should always
match. In addition if MIN_CHAR is set without a timeout then it should not
wake up until MIN_CHAR characters are present. The MIN_CHAR feature is
used by various (these days obscure) protocols to optimise block transfer
rates.

Changing this is also a userspace visible API change.

So NAK.

The underlying intention of the system (and SYS5.4) is that you can do

MIN_CHAR = 64

alarm(some_timeout)
while(1) {
poll();
events
read(chunksized blocks)
}

while it's hardly as critical with modern fast hardware its still the API
and necessary to avoid SWS type behaviours in the queue turning it from
block/syscall to byte I/O.

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH tty-next 5/7] n_tty: Refactor input_available_p() by call site

2013-11-23 Thread One Thousand Gnomes
On Fri, 22 Nov 2013 10:59:23 -0500
Peter Hurley pe...@hurleysoftware.com wrote:

 Distinguish if caller is n_tty_poll() or n_tty_read(), and
 set the read/wakeup threshold accordingly.

That looks very wrong to me. The poll() and read() wakeup should always
match. In addition if MIN_CHAR is set without a timeout then it should not
wake up until MIN_CHAR characters are present. The MIN_CHAR feature is
used by various (these days obscure) protocols to optimise block transfer
rates.

Changing this is also a userspace visible API change.

So NAK.

The underlying intention of the system (and SYS5.4) is that you can do

MIN_CHAR = 64

alarm(some_timeout)
while(1) {
poll();
events
read(chunksized blocks)
}

while it's hardly as critical with modern fast hardware its still the API
and necessary to avoid SWS type behaviours in the queue turning it from
block/syscall to byte I/O.

Alan
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH tty-next 5/7] n_tty: Refactor input_available_p() by call site

2013-11-23 Thread One Thousand Gnomes
On Fri, 22 Nov 2013 10:59:23 -0500
Peter Hurley pe...@hurleysoftware.com wrote:

 Distinguish if caller is n_tty_poll() or n_tty_read(), and
 set the read/wakeup threshold accordingly.
 
 Signed-off-by: Peter Hurley pe...@hurleysoftware.com

Doh ignore previous.. yes that patch is right.  I should pay attention to
0/7 8)
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH tty-next 5/7] n_tty: Refactor input_available_p() by call site

2013-11-23 Thread Peter Hurley

On 11/23/2013 07:26 PM, One Thousand Gnomes wrote:

On Fri, 22 Nov 2013 10:59:23 -0500
Peter Hurley pe...@hurleysoftware.com wrote:


Distinguish if caller is n_tty_poll() or n_tty_read(), and
set the read/wakeup threshold accordingly.

Signed-off-by: Peter Hurley pe...@hurleysoftware.com


Doh ignore previous.. yes that patch is right.  I should pay attention to
0/7 8)


Maybe I should add more to the commit message from the cover letter
description ?

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH tty-next 5/7] n_tty: Refactor input_available_p() by call site

2013-11-22 Thread Peter Hurley
Distinguish if caller is n_tty_poll() or n_tty_read(), and
set the read/wakeup threshold accordingly.

Signed-off-by: Peter Hurley 
---
 drivers/tty/n_tty.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 9298b68..8f2356e 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -1878,14 +1878,15 @@ static int n_tty_open(struct tty_struct *tty)
return 0;
 }
 
-static inline int input_available_p(struct tty_struct *tty, int amt)
+static inline int input_available_p(struct tty_struct *tty, int poll)
 {
struct n_tty_data *ldata = tty->disc_data;
+   int amt = poll && !TIME_CHAR(tty) ? MIN_CHAR(tty) : 1;
 
if (ldata->icanon && !L_EXTPROC(tty)) {
if (ldata->canon_head != ldata->read_tail)
return 1;
-   } else if (read_cnt(ldata) >= (amt ? amt : 1))
+   } else if (read_cnt(ldata) >= amt)
return 1;
 
return 0;
@@ -2384,7 +2385,7 @@ static unsigned int n_tty_poll(struct tty_struct *tty, 
struct file *file,
 
poll_wait(file, >read_wait, wait);
poll_wait(file, >write_wait, wait);
-   if (input_available_p(tty, TIME_CHAR(tty) ? 0 : MIN_CHAR(tty)))
+   if (input_available_p(tty, 1))
mask |= POLLIN | POLLRDNORM;
else if (ldata->icanon)
n_tty_set_room(tty);
-- 
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH tty-next 5/7] n_tty: Refactor input_available_p() by call site

2013-11-22 Thread Peter Hurley
Distinguish if caller is n_tty_poll() or n_tty_read(), and
set the read/wakeup threshold accordingly.

Signed-off-by: Peter Hurley pe...@hurleysoftware.com
---
 drivers/tty/n_tty.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 9298b68..8f2356e 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -1878,14 +1878,15 @@ static int n_tty_open(struct tty_struct *tty)
return 0;
 }
 
-static inline int input_available_p(struct tty_struct *tty, int amt)
+static inline int input_available_p(struct tty_struct *tty, int poll)
 {
struct n_tty_data *ldata = tty-disc_data;
+   int amt = poll  !TIME_CHAR(tty) ? MIN_CHAR(tty) : 1;
 
if (ldata-icanon  !L_EXTPROC(tty)) {
if (ldata-canon_head != ldata-read_tail)
return 1;
-   } else if (read_cnt(ldata) = (amt ? amt : 1))
+   } else if (read_cnt(ldata) = amt)
return 1;
 
return 0;
@@ -2384,7 +2385,7 @@ static unsigned int n_tty_poll(struct tty_struct *tty, 
struct file *file,
 
poll_wait(file, tty-read_wait, wait);
poll_wait(file, tty-write_wait, wait);
-   if (input_available_p(tty, TIME_CHAR(tty) ? 0 : MIN_CHAR(tty)))
+   if (input_available_p(tty, 1))
mask |= POLLIN | POLLRDNORM;
else if (ldata-icanon)
n_tty_set_room(tty);
-- 
1.8.1.2

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/