From: Oleg Verych <olecom@flower.upol.cz>
To: Rob Landley <rob@landley.net>, "Gross, Mark" <mark.gross@intel.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>,
Michael Opdenacker <michael@free-electrons.com>,
linux-tiny@selenic.com,
CE Linux Developers List <celinux-dev@tree.celinuxforum.org>,
linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: Message codes (Re: [Announce] Linux-tiny project revival)
Date: Sat, 22 Sep 2007 03:55:33 +0200 [thread overview]
Message-ID: <20070922015533.GP24301@flower.upol.cz> (raw)
In-Reply-To: <200709211615.39898.rob@landley.net>
On Fri, Sep 21, 2007 at 04:15:39PM -0500, Rob Landley wrote:
[]
> > >Not all, but critical info, that must exist in human-readable form of
> > >course.
> >
> > I disagree. For a production product the you want minimal information
> > to reduce the communication bandwidth required between the remote
> > customer and the support organization.
> >
> > In fact there is a good argument that you don't what the remote customer
> > to know enough to start guessing.
>
> Don't use Linux then. Open source is a horrible fit for the way you think.
>
> I'm sympathetic to "shrink the binary size" arguments. I'm not really
> sympathic to "keep the customer in the dark intentionally" arguments, whether
> the justification is "because they're stupid", "to increase dependency on our
> support staff", or any other reason.
{1}
> > >Seriously. When in the Windows there are only messages like:
> > >
> > > "Error (Code:0x00002012)".
> >
> > Now it's been ~8 years since I did any serious windows work, but if I
> > recall correctly ALL THE FRICKING TIME!!! When was the last time you've
> > seen a bug check on windows? This is about all you get.
>
> I believe he was holding it up as a bad example, and definitely not something
> we want to emulate.
I tried to show, that keeping users in compete information vacuum is a
bad thing. Even without sources, _configuration_ makes another area of
mis-working and bugs, usually addressed by reinstalling.
That may be bad example, because here talk is about developers and
testers, who are not just ordinary users. And by applying Torvalds's Law,
all users are such in some degree. That's why {1} in your reply, Rob,
makes perfect sense.
If Mark have a bad experience with lusers only, then i just can say: what
a pity! AFAIK nobody can read somebody's plain-bin OOP output.
Anyway, anything must be opted by config options, even schedulers. But
maintenance and flame wars rule otherwise :).
What i can propose is form of binary-only "printk", where all info:
diagnostic, error, bug, statistics messages (in not debugging
environment, of course), is just fed right to output buffer (see,
pa, no kmallocs). Info itself must have structured content, that makes it
easy to extract and locate human-readable representation of both message
and data.
This doesn't address loglevels, though.
Implementation (seems) as easy as feeding output to `od` to have
unambiguous form of various troublesome bytes, like "0x00" and "0x0A",
Structuring, who is printing, i.e. arch code, fs, driver whatever, must be
agreed:
* Profiles[0]: originator's ID of a message is a byte (or word, or double word)
0x01 - arch, 0x02 - fs, 0x03 - net, 0x04 - hw drivers, etc.
* Data itself can be sent in form of [0]
[0] Banana -- extendable protocol for sending and receiving s-expressions
http://twistedmatrix.com/projects/core/documentation/specifications/banana.html
and having shell script with functions, that have names that correspond
to actual structured content:
_*_
olecom@flower:/tmp$ sh banana.sh < banana.c >bb
olecom@flower:/tmp$ sh -c '. ./bb ; _07080'
start
olecom@flower:/tmp$ sh -c '. ./bb ; _07081'
ti_startup - product 0000, num configurations 0, configuration value 0
olecom@flower:/tmp$ sh -c '. ./bb ; _07082'
not reached
olecom@flower:/tmp$
olecom@flower:/tmp$ sh -c '. ./bb ; _07081 777 7 8'
ti_startup - product 0x0309, num configurations 7, configuration value 8
olecom@flower:/tmp$
_(banana.c and banana.sh can be found in the ftp /upload on my server)_
>From file linux/drivers/usb/serial/ti_usb*c with
[...]
dbg("%s - product 0x%4X, num configurations %d, configuration value %d",
__FUNCTION__, le16_to_cpu(dev->descriptor.idProduct),
dev->descriptor.bNumConfigurations,
dev->actconfig->desc.bConfigurationValue);
[...]
lets tacke one particular function (transformed a little bit):
_*_
#include <stdio.h>
#define dbg printf
#define ti_startup(foo) main (int argc, char **argv)
#define dev_descriptor_idProduct 3
#define dev_descriptor_bNumConfigurations 4
#define dev_actconfig_desc_bConfigurationValue 5
/* declaration */
int ti_startup(void);
/* implementation */
int ti_startup(void)
{
dbg("start\n");
return dbg("%s - product %#.4x, num configurations %d, "
"configuration value %d\n",
__FUNCTION__, dev_descriptor_idProduct,
dev_descriptor_bNumConfigurations,
dev_actconfig_desc_bConfigurationValue);
/* bla bla */
dbg("not reached\n");
}
_*_
* Process this file with this script: *
_*_
# just as an example
USB_SERIAL_ID=07
TI_USB_ID=08
__FILE__="ti_usb_3410_5052.c" # possible
i=0
sed -n '
# finding function body
/^[[:alpha:]]/{
# found, print it for __FUNCTION__ keyword
s_[^ ]* *\([^ (]*\).*[^;]$_\1_p;
t_func ; b ;
# walking inside of a function
:_func;
# load next string from the input
n;
# while not the end of a function
/^}/{
# insert delimiter, i.e \n\n is the end of a function
s_.*_\n_p;
# go out
b;
};
# find "dbg" (or printk, whatever) inside
/dbg *(/{
:_dbg;
# while not the end of argumet list, i.e ";\n", add other line
/;$/!{N ; b_dbg}
# change C to sh
s_dbg *(_@printf _;
# clear beginnig of the string
s_^[^@]*@__;
# if there is a __FUNCTION__ or __func__ keyword
/__[Ff]/{
# NOTE: then first %s in format is replaced with $FUNC
s_%s_$FUNC_
}
# strip "\n\tabs"
s_\n[[:blank:]]*__g;
# clear the end, i.e |..."format"/,.*//| or |.."format"/).*//|
s_"[,)].*_"_;
# print result
p;
}
b_func;
}'| while read FUNC
do
printf "_$USB_SERIAL_ID$TI_USB_ID(){
FUNC=$FUNC
}
"
FUNC=_$USB_SERIAL_ID$TI_USB_ID
while read -r PRINT
do test "$PRINT" && printf "$FUNC$i() {
$FUNC
%s "'"$@"'"
}
" "$PRINT"
i=$(($i+1))
done
done
_*_
Now switch on imagination and see how printk just puts
'\007\010\params'
and userspace after some banana `od`dity just calls shell functions.
Yet another thing to export to the userspace. But surely only for those
who whats that.
--
-o--=O`C
#oo'L O
<___=E M
next prev parent reply other threads:[~2007-09-22 1:40 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-19 18:03 [Announce] Linux-tiny project revival Tim Bird
2007-09-19 18:47 ` Luis R. Rodriguez
2007-09-19 19:31 ` Tim Bird
2007-09-19 19:01 ` Christian MICHON
2007-09-19 19:28 ` Andi Kleen
2007-09-19 19:41 ` Tim Bird
2007-09-19 20:45 ` Valdis.Kletnieks
2007-09-19 21:29 ` Tim Bird
2007-09-19 22:29 ` Michael Opdenacker
2007-09-19 21:28 ` [Celinux-dev] " Andrew Morton
2007-09-19 21:41 ` Tim Bird
2007-09-19 22:38 ` Michael Opdenacker
2007-09-20 9:10 ` Andy Whitcroft
2007-09-20 17:10 ` Monster switch for small size (was Linux-tiny revival) Tim Bird
2007-09-20 21:41 ` Rob Landley
2007-09-20 20:50 ` Randy Dunlap
2007-09-21 6:35 ` Christian MICHON
2007-09-20 23:02 ` [Celinux-dev] [Announce] Linux-tiny project revival Rob Landley
2007-09-20 20:38 ` Rob Landley
2007-09-20 19:58 ` Alexey Dobriyan
2007-09-20 20:22 ` printk proposal - (was Linux-tiny project revival) Tim Bird
2007-09-21 19:07 ` Alexey Dobriyan
2007-09-21 20:53 ` Rob Landley
2007-09-20 22:02 ` [Announce] Linux-tiny project revival Rob Landley
2007-09-20 21:22 ` Jared Hulbert
2007-09-20 22:53 ` Rob Landley
2007-09-20 22:15 ` [Celinux-dev] " Gross, Mark
2007-09-21 0:57 ` Message codes (Re: [Announce] Linux-tiny project revival) Oleg Verych
2007-09-21 14:18 ` Gross, Mark
2007-09-21 21:15 ` Rob Landley
2007-09-21 22:12 ` Gross, Mark
2007-09-21 22:33 ` Joe Perches
2007-09-21 22:39 ` Gross, Mark
2007-09-22 1:55 ` Oleg Verych [this message]
2007-09-21 13:29 ` [Announce] Linux-tiny project revival Dick Streefland
2007-09-20 20:16 ` Joe Perches
2007-09-25 11:43 ` [Celinux-dev] " Geert Uytterhoeven
2007-09-20 21:26 ` Indan Zupancic
2007-09-20 23:18 ` Rob Landley
2007-09-20 23:06 ` Indan Zupancic
2007-09-21 6:29 ` Sam Ravnborg
2007-09-24 18:13 ` Adrian Bunk
2007-09-26 6:24 ` Rob Landley
2007-09-21 17:16 ` Valdis.Kletnieks
2007-09-21 17:45 ` Joe Perches
2007-09-21 23:05 ` Rob Landley
2007-09-21 23:08 ` Joe Perches
2007-09-21 21:34 ` Kyle Moffett
2007-09-21 22:05 ` Joe Perches
2007-09-21 22:57 ` Kyle Moffett
2007-09-20 21:58 ` Tim Bird
2007-09-20 22:14 ` Joe Perches
2007-09-21 0:28 ` Rob Landley
2007-09-21 0:03 ` Joe Perches
2007-09-20 23:11 ` Rob Landley
2007-09-21 12:27 ` Bill Davidsen
2007-09-27 7:00 ` Arnd Bergmann
2007-09-27 16:35 ` Indan Zupancic
2007-09-27 22:21 ` Arnd Bergmann
2007-09-28 8:39 ` Bernd Petrovitsch
2007-09-30 20:37 ` Jörn Engel
2007-09-28 0:06 ` Rob Landley
2007-09-28 14:36 ` Dick Streefland
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=20070922015533.GP24301@flower.upol.cz \
--to=olecom@flower.upol.cz \
--cc=adobriyan@gmail.com \
--cc=celinux-dev@tree.celinuxforum.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tiny@selenic.com \
--cc=mark.gross@intel.com \
--cc=michael@free-electrons.com \
--cc=rob@landley.net \
/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
all inboxes | Powered by JetHome®