* [patch] epoll for 2.4.20 updated ... @ 2003-01-25 4:06 Davide Libenzi 2003-01-25 21:58 ` J.A. Magallon 2003-01-26 0:15 ` J.A. Magallon 0 siblings, 2 replies; 5+ messages in thread From: Davide Libenzi @ 2003-01-25 4:06 UTC (permalink / raw) To: Linux Kernel Mailing List; +Cc: Janet Morgan I updated the 2.4.20 patch with the changes posted today and I fixed a little error about the wait queue function prototype : http://www.xmailserver.org/linux-patches/sys_epoll-2.4.20-0.61.diff - Davide ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] epoll for 2.4.20 updated ... 2003-01-25 4:06 [patch] epoll for 2.4.20 updated Davide Libenzi @ 2003-01-25 21:58 ` J.A. Magallon 2003-01-25 23:44 ` Davide Libenzi 2003-01-26 0:15 ` J.A. Magallon 1 sibling, 1 reply; 5+ messages in thread From: J.A. Magallon @ 2003-01-25 21:58 UTC (permalink / raw) To: Davide Libenzi; +Cc: Linux Kernel Mailing List, Janet Morgan On 2003.01.25 Davide Libenzi wrote: > > I updated the 2.4.20 patch with the changes posted today and I fixed a > little error about the wait queue function prototype : > > http://www.xmailserver.org/linux-patches/sys_epoll-2.4.20-0.61.diff > Mixing epoll ontop of current aa, I found this: #define add_wait_queue_cond(q, wait, cond) \ ({ \ unsigned long flags; \ int _raced = 0; \ wq_write_lock_irqsave(&(q)->lock, flags); \ (wait)->flags = 0; \ __add_wait_queue((q), (wait)); \ mb(); \ if (!(cond)) { \ _raced = 1; \ __remove_wait_queue((q), (wait)); \ } \ wq_write_unlock_irqrestore(&(q)->lock, flags); \ _raced; \ }) this is the -aa version. Version from epoll uses just a rmb() barrier (afaik, just a _read_ barrier). In -aa they are just the same, but I also use a patch that does this: +#ifdef CONFIG_X86_MFENCE +#define mb() __asm__ __volatile__ ("mfence": : :"memory") +#else #define mb() __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory") +#endif + +#ifdef CONFIG_X86_LFENCE +#define rmb() __asm__ __volatile__ ("lfence": : :"memory") +#else #define rmb() mb() +#endif so for modern processors they are different, and can affect performance and correctness. So which one it the correct one for the above code snipet ? TIA -- J.A. Magallon <jamagallon@able.es> \ Software is like sex: werewolf.able.es \ It's better when it's free Mandrake Linux release 9.1 (Cooker) for i586 Linux 2.4.21-pre3-jam3 (gcc 3.2.1 (Mandrake Linux 9.1 3.2.1-3mdk)) ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] epoll for 2.4.20 updated ... 2003-01-25 21:58 ` J.A. Magallon @ 2003-01-25 23:44 ` Davide Libenzi 0 siblings, 0 replies; 5+ messages in thread From: Davide Libenzi @ 2003-01-25 23:44 UTC (permalink / raw) To: J.A. Magallon; +Cc: Linux Kernel Mailing List, Janet Morgan On Sat, 25 Jan 2003, J.A. Magallon wrote: > > On 2003.01.25 Davide Libenzi wrote: > > > > I updated the 2.4.20 patch with the changes posted today and I fixed a > > little error about the wait queue function prototype : > > > > http://www.xmailserver.org/linux-patches/sys_epoll-2.4.20-0.61.diff > > > > Mixing epoll ontop of current aa, I found this: > > #define add_wait_queue_cond(q, wait, cond) \ > ({ \ > unsigned long flags; \ > int _raced = 0; \ > wq_write_lock_irqsave(&(q)->lock, flags); \ > (wait)->flags = 0; \ > __add_wait_queue((q), (wait)); \ > mb(); \ > if (!(cond)) { \ > _raced = 1; \ > __remove_wait_queue((q), (wait)); \ > } \ > wq_write_unlock_irqrestore(&(q)->lock, flags); \ > _raced; \ > }) > > this is the -aa version. Version from epoll uses just a rmb() barrier > (afaik, just a _read_ barrier). In -aa they are just the same, but I also > use a patch that does this: > > > +#ifdef CONFIG_X86_MFENCE > +#define mb() __asm__ __volatile__ ("mfence": : :"memory") > +#else > #define mb() __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory") > +#endif > + > +#ifdef CONFIG_X86_LFENCE > +#define rmb() __asm__ __volatile__ ("lfence": : :"memory") > +#else > #define rmb() mb() > +#endif > > so for modern processors they are different, and can affect performance and > correctness. So which one it the correct one for the above code snipet ? It depends on what "cond" does. Being it a macro I'd feel safer with an mb(). - Davide ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] epoll for 2.4.20 updated ... 2003-01-25 4:06 [patch] epoll for 2.4.20 updated Davide Libenzi 2003-01-25 21:58 ` J.A. Magallon @ 2003-01-26 0:15 ` J.A. Magallon 2003-01-26 0:28 ` Davide Libenzi 1 sibling, 1 reply; 5+ messages in thread From: J.A. Magallon @ 2003-01-26 0:15 UTC (permalink / raw) To: Davide Libenzi; +Cc: Linux Kernel Mailing List On 2003.01.25 Davide Libenzi wrote: > > I updated the 2.4.20 patch with the changes posted today and I fixed a > little error about the wait queue function prototype : > > http://www.xmailserver.org/linux-patches/sys_epoll-2.4.20-0.61.diff > I needed this to build smbfs: --- linux-2.4.21-pre3-jam3/fs/smbfs/sock.c.orig 2003-01-26 01:02:32.000000000 +0100 +++ linux-2.4.21-pre3-jam3/fs/smbfs/sock.c 2003-01-26 01:03:11.000000000 +0100 @@ -314,7 +314,7 @@ smb_receive_poll(struct smb_sb_info *server) { struct file *file = server->sock_file; - poll_table wait_table; + struct poll_wqueues wait_table; int result = 0; int timeout = server->mnt->timeo * HZ; int mask; @@ -323,7 +323,7 @@ poll_initwait(&wait_table); set_current_state(TASK_INTERRUPTIBLE); - mask = file->f_op->poll(file, &wait_table); + mask = file->f_op->poll(file, &wait_table.pt); if (mask & POLLIN) { poll_freewait(&wait_table); current->state = TASK_RUNNING; Is it correct ? TIA -- J.A. Magallon <jamagallon@able.es> \ Software is like sex: werewolf.able.es \ It's better when it's free Mandrake Linux release 9.1 (Cooker) for i586 Linux 2.4.21-pre3-jam3 (gcc 3.2.1 (Mandrake Linux 9.1 3.2.1-4mdk)) ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] epoll for 2.4.20 updated ... 2003-01-26 0:15 ` J.A. Magallon @ 2003-01-26 0:28 ` Davide Libenzi 0 siblings, 0 replies; 5+ messages in thread From: Davide Libenzi @ 2003-01-26 0:28 UTC (permalink / raw) To: J.A. Magallon; +Cc: Linux Kernel Mailing List On Sun, 26 Jan 2003, J.A. Magallon wrote: > > On 2003.01.25 Davide Libenzi wrote: > > > > I updated the 2.4.20 patch with the changes posted today and I fixed a > > little error about the wait queue function prototype : > > > > http://www.xmailserver.org/linux-patches/sys_epoll-2.4.20-0.61.diff > > > > I needed this to build smbfs: > > --- linux-2.4.21-pre3-jam3/fs/smbfs/sock.c.orig 2003-01-26 01:02:32.000000000 +0100 > +++ linux-2.4.21-pre3-jam3/fs/smbfs/sock.c 2003-01-26 01:03:11.000000000 +0100 > @@ -314,7 +314,7 @@ > smb_receive_poll(struct smb_sb_info *server) > { > struct file *file = server->sock_file; > - poll_table wait_table; > + struct poll_wqueues wait_table; > int result = 0; > int timeout = server->mnt->timeo * HZ; > int mask; > @@ -323,7 +323,7 @@ > poll_initwait(&wait_table); > set_current_state(TASK_INTERRUPTIBLE); > > - mask = file->f_op->poll(file, &wait_table); > + mask = file->f_op->poll(file, &wait_table.pt); > if (mask & POLLIN) { > poll_freewait(&wait_table); > current->state = TASK_RUNNING; > > Is it correct ? I thought this was already been reported and fixed. Your fix is fine, I'll make 0.62 ... - Davide ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-01-26 0:13 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2003-01-25 4:06 [patch] epoll for 2.4.20 updated Davide Libenzi 2003-01-25 21:58 ` J.A. Magallon 2003-01-25 23:44 ` Davide Libenzi 2003-01-26 0:15 ` J.A. Magallon 2003-01-26 0:28 ` Davide Libenzi
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox