public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Aloni <da-x@gmx.net>
To: bert hubert <ahu@ds9a.nl>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] [PATCH] C exceptions in kernel
Date: 23 Feb 2002 18:05:48 +0200	[thread overview]
Message-ID: <1014480355.1844.16.camel@callisto.yi.org> (raw)
In-Reply-To: <20020223162100.A1952@outpost.ds9a.nl>
In-Reply-To: <1014412325.1074.36.camel@callisto.yi.org>  <20020223162100.A1952@outpost.ds9a.nl>

On Sat, 2002-02-23 at 17:21, bert hubert wrote:
> On Fri, Feb 22, 2002 at 09:18:29PM +0000, Dan Aloni wrote:
> > The attached patch implements C exceptions in the kernel, which *don't*
> > depend on special support from the compiler. This is a 'request for
> > comments'. The patch is very initial, should not be applied.
> > 
> > I actually got this code to work in the kernel:
> > 
> >         try {
> >                 printk("TEST: before throwing \n");
> >                 throw(1000);
> >                 printk("TEST: won't run\n");
> >         }
> >         catch(unsigned long, value) {
> >                 printk("TEST: caught: %ld\n", value);
> >         } yrt;
> 
> Can they fall through multiple function calls? How do they jive with
> preemtive scheduling? How much is the stack unwinding overhead?

They fall through several function calls like they should.

I don't see any problem with preemtive scheduling (every kernel thread
has its own seperated exception frames). 

The overhead on the stack is 36 bytes for each exception frame (a
context of a try block). The unwinding procedure itself is short, the
throw macro calls a rather small asm function for an unwind.

> Potentially this is very cool but I'm again appalled at the INSTANT
> rejection seen here by kernel hackers, minor and major. Do NOT reject an
> idea before you've thought it through. Do NOT reject an idea simply because
> it is new.
 
> Also, do not jump on the bandwagon BECAUSE it is new. But still - people
> here should get a life if they get off on rejecting new stuff because it is
> new.

Whether it is accepted or not, I can't see it being used in the core
kernel code, just because there is too much code to rewrite for it to
happen. Maybe if this thing was proposed back in 1992/3 it would have
been different.

But, it CAN be used in *local* driver call branches. Writing a new
driver? have a lot of local nested calls? Hate goto's? You can use
exceptions.

The only problem is that because C is natively not object oriented, it's
hard to come up with an exception scheme for the C language that is
better than ye' old goto's, like in C++ when you have automatic
destruction during unwinding.


  reply	other threads:[~2002-02-23 16:11 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-22 21:12 [RFC] [PATCH] C exceptions in kernel Dan Aloni
2002-02-22 21:28 ` Davide Libenzi
2002-02-22 22:10 ` Richard B. Johnson
2002-02-22 22:34 ` David B. Stevens
2002-02-22 22:48   ` Davide Libenzi
2002-02-23  3:37 ` Edgar Toernig
     [not found] ` <mailman.1014437101.26721.linux-kernel2news@redhat.com>
2002-02-23 10:11   ` Pete Zaitcev
2002-02-23 12:26     ` Keith Owens
2002-02-23 12:50       ` Pete Zaitcev
2002-02-23 23:07         ` Jes Sorensen
2002-02-23 23:40           ` Keith Owens
2002-02-24  1:02             ` Jes Sorensen
2002-02-24 23:45               ` Richard Gooch
2002-02-23 23:50         ` Bill Huey
2002-02-24  1:31           ` Davide Libenzi
2002-02-24  2:55             ` Bill Huey
2002-02-23 15:13 ` Felix von Leitner
2002-02-23 15:21 ` bert hubert
2002-02-23 16:05   ` Dan Aloni [this message]
2002-02-23 16:22     ` Larry McVoy
2002-02-23 17:00       ` Dan Aloni
2002-02-23 17:52         ` Francois Romieu
2002-02-23 17:07       ` bert hubert
2002-02-23 17:47   ` Alexander Viro
2002-02-23 18:21     ` bert hubert
2002-02-23 18:31       ` Larry McVoy
2002-02-23 18:38         ` bert hubert
2002-02-23 19:12           ` Kurt Ferreira
2002-02-23 23:05       ` Jes Sorensen

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=1014480355.1844.16.camel@callisto.yi.org \
    --to=da-x@gmx.net \
    --cc=ahu@ds9a.nl \
    --cc=linux-kernel@vger.kernel.org \
    /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