public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@googlemail.com>
To: Daniel Phillips <phillips@istop.com>
Cc: Bill Davidsen <davidsen@tmr.com>, linux-kernel@vger.kernel.org
Subject: Re: RFC: i386: kill !4KSTACKS
Date: Wed, 7 Sep 2005 22:28:12 +0200	[thread overview]
Message-ID: <58d0dbf105090713283aa455e8@mail.gmail.com> (raw)
In-Reply-To: <200509071552.27543.phillips@istop.com>

2005/9/7, Daniel Phillips <phillips@istop.com>:
> > > Is there a technical reason ("hard to implement" is a practical reason)
> > > why all stacks need to be the same size?
> >
> > Because of
> >
> > static inline struct thread_info *current_thread_info(void)
> > {
> >         struct thread_info *ti;
> >         __asm__("andl %%esp,%0; ":"=r" (ti) : "" (~(THREAD_SIZE - 1)));
> >         return ti;
> > }
> > [include/asm-i386/thread_info.h]
> >
> > which assumes that it can "round down" the stack pointer and then will
> > find the thread_info of the current context there. Only works for
> > identically sized stacks. Note that this function is heavily used in
> > the kernel, either directly or indirectly. You cannot avoid it.
> >
> > My current assessment regarding differently sized threads for
> > ndiswrapper: not feasible with vanilla kernels.
> 
> If so, it is not because of this.  It just means you have to go back to the
> idea of switching back to the original stack when the Windows driver calls
> into the ndis API.  (It must have been way too late last night when I claimed
> the second stack switch wasn't necessary.)

That alone doesn't help. You would also have to disable at least bh
while windows functions are being executed, otherwise the scheduler
may crash when trying to switch to some other task. Even worse with 4K
stacks: take a look at how do_IRQ works, the common interrupt entry
point. It calls current_thread_info, thus expects to preempt normal
kernel stacks. So, should we execute Windows driver code with IRQs
off? I don't think so.

> 
> Other issues:
> 
>   - Use a semaphore to serialize access to a single ndis stack... any
>     spinlock or interrupt state issues?  (I didn't notice any.)

Too simple approach. You cannot deny that two or more functions of
ndiswrapper or the windows driver are being executed concurrently.

> 
>   - Copy parameters across the stack switch - a little tricky, but far from
>     the trickiest bit of glue in the kernel
> 
>   - Preempt - looks like it has to be disabled from switching to the ndis
>     stack to switching back because of the thread_info problem
> 
>   - It is best for Linux when life is a little hard for binary-only drivers,
>     but not completely impossible.  When the smoke clears, ndis wrapper will
>     be slightly slower than before and we will be slightly closer to having
>     some native drivers.  In the meantime, keeping the thing alive without
>     impacting core is an interesting puzzle.

Ndiswrapper is already slower than native drivers are, also due to
horribly implemented Windows drivers btw (the ndis model itself isn't
that bad, though).

After all the issues coming up, I'm even more convinced that any
effort on stack switching is better spent on moving ndiswrapper to
userspace - also expensive but safer in many ways.

Jan

  parent reply	other threads:[~2005-09-07 20:28 UTC|newest]

Thread overview: 118+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-04 14:51 RFC: i386: kill !4KSTACKS Alex Davis
2005-09-04 17:11 ` Stefan Smietanowski
2005-09-04 17:11   ` Dr. David Alan Gilbert
2005-09-04 17:19 ` Alan Cox
2005-09-06  4:37   ` Andi Kleen
2005-09-06  6:39     ` Denis Vlasenko
2005-09-06  7:13       ` Andi Kleen
2005-09-06  7:32         ` Nick Piggin
2005-09-06  7:50           ` Andi Kleen
2005-09-06 13:29           ` Diego Calleja
2005-09-06 13:25     ` Giridhar Pemmasani
2005-09-06 17:05       ` Jan Kiszka
2005-09-06 17:23         ` Giridhar Pemmasani
2005-09-06 18:42           ` linux-os (Dick Johnson)
2005-09-06 18:46             ` viro
2005-09-06 19:42           ` Jan Kiszka
2005-09-06 20:21             ` linux-os (Dick Johnson)
2005-09-07 17:46             ` Bill Davidsen
2005-09-07 17:54               ` Jan Kiszka
2005-09-07 19:52                 ` Daniel Phillips
2005-09-07 20:17                   ` Daniel Phillips
2005-09-07 20:29                     ` Jan Kiszka
2005-09-07 20:28                   ` Jan Kiszka [this message]
2005-09-07 21:57                     ` Giridhar Pemmasani
2005-09-07 23:25                       ` Jan Kiszka
2005-09-08  1:06                         ` Giridhar Pemmasani
2005-09-08 19:43                 ` Bill Davidsen
2005-09-06 22:19           ` Daniel Phillips
2005-09-06 22:21             ` Andi Kleen
2005-09-06 22:36               ` Daniel Phillips
2005-09-06 23:40                 ` Steven Rostedt
2005-09-06 22:28             ` Roland Dreier
2005-09-07  0:04               ` Daniel Phillips
2005-09-06 22:42             ` Giridhar Pemmasani
2005-09-07  1:59             ` Mark Lord
2005-09-07  3:46               ` Lee Revell
2005-09-07  4:16               ` Daniel Phillips
2005-09-07  5:48                 ` Daniel Phillips
2005-09-07 16:43 ` Bill Davidsen
2005-09-08  0:44   ` Alex Davis
  -- strict thread matches above, loose matches on Subject: below --
2005-09-06 10:29 Chuck Ebbert
2005-09-05  2:00 Alex Davis
2005-09-05  2:07 ` Sean
2005-09-05  2:29   ` Alex Davis
2005-09-05  3:00     ` Sean
2005-09-05  3:41       ` Alex Davis
2005-09-05  3:51         ` Sean
2005-09-05  4:03           ` Alex Davis
2005-09-05  4:12             ` Sean
2005-09-05  4:36               ` Willy Tarreau
2005-09-05  4:47                 ` Sean
2005-09-05  5:01                   ` Willy Tarreau
2005-09-05  5:31                     ` Sean
2005-09-05  6:04                       ` Willy Tarreau
2005-09-05  6:20                         ` Sean
2005-09-05  6:29                         ` Pekka Enberg
2005-09-05 15:29                     ` Horst von Brand
2005-09-08 20:18                       ` Bill Davidsen
2005-09-08 22:51                         ` Sean
2005-09-05  6:41                 ` Sander
2005-09-05  8:01                   ` Willy Tarreau
2005-09-08 20:01                 ` Bill Davidsen
2005-09-08 20:24                   ` Christopher Friesen
2005-09-05  3:54         ` Kyle Moffett
2005-09-05  4:26         ` Dave Jones
2005-09-05  4:48           ` Willy Tarreau
2005-09-06 17:04           ` Benjamin LaHaise
2005-09-05  1:30 Alex Davis
2005-09-05  1:41 ` Adrian Bunk
2005-09-05  1:56   ` dean gaudet
     [not found] <4I7UM-M1-1@gated-at.bofh.it>
     [not found] ` <4ITG4-8nH-1@gated-at.bofh.it>
     [not found]   ` <4J1DC-2NU-1@gated-at.bofh.it>
2005-09-04 17:33     ` Robert Hancock
     [not found] <4IcUz-7H2-27@gated-at.bofh.it>
     [not found] ` <4J2gx-3zf-3@gated-at.bofh.it>
     [not found]   ` <4J5R1-cH-21@gated-at.bofh.it>
     [not found]     ` <4J6ao-L9-21@gated-at.bofh.it>
     [not found]       ` <4J6jZ-Xg-11@gated-at.bofh.it>
     [not found]         ` <4J8vt-43Y-13@gated-at.bofh.it>
2005-09-02  6:08           ` Alex Davis
2005-09-04 12:49             ` Denis Vlasenko
2005-09-04 13:30               ` Ed Tomlinson
2005-09-04 14:49                 ` Alan Cox
2005-09-04 16:44               ` Paul Misner
2005-09-04 17:07                 ` Pekka Enberg
2005-09-04 17:12                   ` Bas Westerbaan
2005-09-04 19:22                     ` Horst von Brand
2005-09-04 19:33                     ` Adrian Bunk
2005-09-04 20:13                       ` Bas Westerbaan
2005-09-04 20:37                         ` Dave Jones
2005-09-07 16:38                           ` Bill Davidsen
2005-09-07 17:53                             ` Mike Galbraith
2005-09-08 19:05                               ` Bill Davidsen
2005-09-05 22:32                       ` Thorild Selen
2005-09-05 23:06                         ` Kyle Moffett
2005-09-02  0:39 Adrian Bunk
2005-09-02  5:33 ` Chris Wedgwood
2005-09-02  6:29   ` Nathan Scott
2005-09-02  6:40     ` Neil Brown
2005-09-13  8:05       ` Alexander Nyberg
2005-10-01 22:50         ` Adrian Bunk
2005-10-02 20:35           ` Nathan Scott
2005-09-02  6:55 ` Vladimir V. Saveliev
2005-09-02 21:58 ` Hans Reiser
2005-09-04  3:48 ` Lee Revell
2005-09-04  7:36   ` Stefan Smietanowski
2005-09-04  8:23     ` Lee Revell
2005-09-04 19:39       ` Adrian Bunk
2005-09-04 12:12   ` Guillaume Chazarain
2005-09-04 13:26 ` Sander
2005-06-08 12:35 Ian Kumlien
2005-06-08 13:14 ` Denis Vlasenko
2005-06-07 21:27 Adrian Bunk
2005-06-07 21:47 ` Alexander Nyberg
2005-06-08 10:03   ` Jörn Engel
2005-06-08 10:39   ` Denis Vlasenko
2005-06-08 11:12     ` Adrian Bunk
2005-06-08 12:13       ` Denis Vlasenko
2005-07-04 18:22         ` Adrian Bunk
2005-07-05  6:14           ` Denis Vlasenko
2005-07-05 13:46             ` Horst von Brand
2005-06-08  1:52 ` Ian Kent
2005-06-08 10:42   ` Denis Vlasenko
2005-06-08 14:28     ` raven
2005-06-08 12:00 ` Vladimir Saveliev
2005-06-10 15:18   ` Vladimir Saveliev

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=58d0dbf105090713283aa455e8@mail.gmail.com \
    --to=jan.kiszka@googlemail.com \
    --cc=davidsen@tmr.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=phillips@istop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox