Gary Thorpe | 1 Jan 2003 21:01
Picon
Favicon

Re: Nitty-gritty questions on locking and interrupts

 --- kpneal <at> pobox.com wrote: > Ok, so I've got some work I want to do
in the kernel. It involves
> code that lives in the top and bottom halves, and so runs in either
> a process context (right?) or an interrupt context. 
> 
> Now, what does this top/bottom split mean in an SMP world? Different
> processors in the same system can at any point in time have different
> spl
> levels/masks, right? Are the spl calls going to go away?

I would guess (having no real knowledge of the SMP code in NetBSD),
that spl calls will still be needed to prevent lower priority
preemption of an interrupt handler running on a processor. I would also
guess that different processors would have different spl levels/masks.

> 
> What is the correct way to write code that lives on the boundry
> between
> top and bottom but is still SMP-safe?
> 
> The simple_lock man page says this on struct simplelock:
> 
>               Simplelocks are usually used only by the high-level
> lock manager
>               and to protect short, critical sections of code. 
> Simplelocks
>               are the only locks that can be be used inside an
> interrupt han-
>               dler.  For a simplelock to be used in an interrupt
> handler, care
(Continue reading)

Matthew Mondor | 2 Jan 2003 14:12
Picon

i386 16-bit

Hi all,

I am often experiencing problems on netbsd with i386 16-bit code assembler
files which generally build fine on freebsd or linux... Anyone have an idea
of what might be going wrong?

cc -Wall -Iinclude -c -o bin/init16.o init16.S
/tmp/ccVO3S7B.s: Assembler messages:
/tmp/ccVO3S7B.s:138: Error: base/index register must be 32 bit register
/tmp/ccVO3S7B.s:148: Error: base/index register must be 32 bit register
gmake: *** [bin/init16.o] Error 1

and the file begins as follows:

#include <asm-inc/boot.h>
#include <asm-inc/segdefs.h>
#include <asm-inc/meminfo.h>

code16
text

globl _start

/* =======================================================================
 *                                                                      _start
 * ======================================================================= */
_start:
/* Kernel starts here.   This is the first bit of code to be executed after
 * the boot loader.  Here we do some initialization using BIOS, before we
[...]
(Continue reading)

Matthew Fincham | 2 Jan 2003 15:38
Picon

Hard Drive Read Problems


Hi all,
 
I am using NetBSD 1.5.1 and have upgraded my pc and since noticed some harddrive read problems. My first PC (Celeron 1.2Ghz) had the Intel 815 chip for control of the Hard drive and my new one (P4 Celeron 2Ghz) uses the Intel 845 chip. I noticed that new PC was a bit sluggish and at times slower than my old one. After some time I realized that the harddrive access was slower on the P4 celeron using the 845 than on the 1.2 celeron using the 815 chip. To test this I wrote a small program which would seek to a location on the drive and then read 640k into memory and repeat. I would then time the read operation. This program confirmed my suspicion that reading from the hard drive was a great deal slower on the P4 Celeron (Intel 845 chip) than on the 1.2 Celeron (Intel 815). In both cases the hard drive is exactly the same. I am unsure as to what can cause such a problem. Is it a driver issue and is there something I can do to fix the problem? How would I fix the problem?
 
An added note is the the system improves dramatically with netBSD 1.6 and both PC's operate as expected. However I do not want to upgrade to 1.6 just yet and would like a solution for 1.5.1, if possible.
 
Any help is much appreciated
 
Ian
Wojciech Puchar | 2 Jan 2003 18:45

Re: Hard Drive Read Problems

>
> An added note is the the system improves dramatically with netBSD 1.6 and both PC's operate as expected.
However I do not want to upgrade to 1.6 just yet and would like a solution for 1.5.1, if possible.
>
possibly NetBSD 1.5 doesn't fully support this new IDE controller while
1.6 do so.

please look at dmesg output if this harddrive use DMA at all.

to measure transfers

dd if=/dev/rwd0d of=/dev/null bs=64k count=2048

is useful (on really fast drives try higher count).

please do not mail with almost no line breaks. it could be (and is)
annoying.

Bill Studenmund | 2 Jan 2003 19:00
Picon

Re: kernel filesystem code move

On Sun, 29 Dec 2002, Chuck Silvers wrote:

> On Thu, Dec 26, 2002 at 03:40:21PM +0100, Jaromir Dolecek wrote:
> > I'd like to know what is general opinion of what should be
> > done with the rest of filesystems.
>
> hi,
>
> leaving aside the issue of CVS's shortcomings with regard to
> source tree rearrangement, I think that if we're consolidating
> file system code in one place, it would make the most sense
> to be consistent and move it all there.  yes, this means that
> people would need to look in multiple places to find the history
> of the code, but that's not difficult.  if avoiding this was
> all that important, we shouldn't have moved any of it.
> in the long run, I think that having a more consistent
> arrangement will be for the best.

While I can maybe see an excuse for leaving ufs and nfs alone, I agree if
we are moving stuff to fs/, we should move it all. If we have fs/, we
souldn't have miscfs/ anymore.

Take care,

Bill

Bill Studenmund | 2 Jan 2003 19:31
Picon

Re: [RFC] Running reverse-endian binaries

On 26 Dec 2002, Michael Graff wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> This sounds like a Bad Idea.  Sorry.  :)
>
> Wouldn't you have to runtime choose which htonl() and so on to run?
> Remember that it's not just for kernel stuff, it's also for on-disk
> and in-packet data.

I don't think so. Code would be compiled for either big or little endian,
and you make the decision then. The kernel would come along later and just
make sure to run the code with the CPU set to the right mode.

> I don't see a straight-forward way of doing that which won't kill
> performance, cause major issues with nightmare-like hacks, or both.

Yes, the kernel/userland boundry would become even more expensive. But we
should be able to hide everything in the emulation layer.

Take care,

Bill

Bill Studenmund | 2 Jan 2003 19:35
Picon

Re: [RFC] Running reverse-endian binaries

On Thu, 26 Dec 2002, Martin Husemann wrote:

> On Thu, Dec 26, 2002 at 09:37:08PM +0100, Emmanuel Dreyfus wrote:
>
> > - add a P_REVENDIAN p_flag in struct proc
>
> Isn't it easier to run those binaries under another emulation? (netbsd-re?
> netbsd-le/netbsd-be?) Sounds pretty similar to the netbsd32 emul on sparc64.
>
> You'd need to run a completely different userland anyway for those binaries.

I think a separate emulation would be the best thing, with the hooks to
make sure the CPU endianism is set right. Among other things, that makes
it BLATANTLY OBVIOUS to all parts of the kernel what is going on. Also,
the emulation code would handle endianism-switching of syscall arguments.

Take care,

Bill

Jason R Thorpe | 2 Jan 2003 22:37

gmcgarry_ctxsw problems

I've been looking at Greg's new context switch code on the above-mentioned
branch, and have identified some problems with it:

	1. sched_lock is released too early.  Specifically, it is released
	   before having completely switched away from the outgoing proc.
	   This is a race condition that will break MP systems (and has
	   in the past, until cpu_switch() was fixed on i386 and alpha).

	2. It does not properly handle switching to an idle context.  On
	   UP systems, this means proc0's PCB.  On MP systems, this means
	   the CPU's idle PCB.  On the VAX, this means the CPU's interrupt
	   stack.

	3. It doesn't not have any way to communicate the info that can
	   currently be passed between cpu_switch() and idle().  For the
	   most part, that means "remembering if we're switching to the
	   same process again" -- this is more complicated in MP systems.

For this reason, I think the approach taken by Greg's new code needs
to be reexamined.  I think probably a better way to handle it is for
cpu_switch() to actually call an MI C function to get the new process
to switch to.  That is, leave it mostly the same as it is now, just
replace the code that looks at the run queues with a function call.

--

-- 
        -- Jason R. Thorpe <thorpej <at> wasabisystems.com>

Greg A. Woods | 3 Jan 2003 01:49
X-Face
Favicon

Re: kernel filesystem code move

[ On , December 28, 2002 at 23:53:43 (-0500), Perry E. Metzger wrote: ]
> Subject: Re: kernel filesystem code move
>
> cgd <at> broadcom.com writes:
> > At Sun, 29 Dec 2002 00:47:20 +0000 (UTC), "Perry E. Metzger" wrote:
> > > How about if one did a copy but altered the dates in the duplicate? It
> > > is pretty easy to do that. One then retains a modicum of revision
> > > history.
> > 
> > So, for the sake of "keeping history" you change that history?  "Hmm."
> 
> I have a slightly better suggestion, then. You alter CVS to allow you
> to specify a "don't do checkouts by date on this file before date X"
> or "before revision X" or some such. That allows us to move the file
> and still avoid breaking checkout by date.

You still have the problem of the missing/modified tags.  You have to
remove or uniquely modify all the existing release and branch tags in
the new copy.  That's definitely altering some very important history
information.  If you do the simple and safest hack of just removing all
old tags then you still often have to refer to the old copy for what
many (most?) of us consider to be extremely important details for a
project like NetBSD.  If you don't remove the tags but instead find some
way to uniquely rename them while preserving their old meaning to a
human reader then you have to ensure your naming conventions for the
renamed tags allow for multiple moves of files and you have to hope
users can intuit the meaning of these renamed tags when they can't find
the documentation for your tag naming conventions (keep in mind that tag
names are effectively severely limited in length).

Doing file moves the plain and proper CVS way (i.e. "cvs rm" the old
file and "cvs add") really is the best and only sure and safe way to
move files in a project managed with CVS.

Anyone who says that the "rm/add" process deletes revision history isn't
really looking at the big picture.  Not doing moves the standard way is
what mucks up revision history!  Nothing is lost with the "rm/add"
process -- and if a suitable commit message is included for both
operations then all the information necessary to track multiple moves is
in fact added and nothing is ever deleted:  it's all right there where
it always was.

Wrapper scripts can even be implemented which make all the standard
auditing operations work across moves.  One often recommended way to do
this is by creating and later interpreting meaningful special phrases at
key locations in the commit messages used for the removed and added
revisions.  Thus even without the help of these wrapper scripts a
competent CVS user can still very easily follow everything that's
happened to a file.

I do sort of like the idea of also including the old file's full "cvs
log" output in the first commit message of the new file.  This makes the
the release and branch tags and their revision numbers, as well as all
of the commit messages, available immediately in the "history" of the
new file and that can eliminates at least one step from the job of
looking at previous changes in the old file.  One could also always add
a custom "newphrase" to hold this data in the delta header, though then
you'd probably need a custom version of CVS to conveniently access it
again.

> You might ask, why do I care. The reason is primarily dealing with
> things like vendor branches and merges with other codebases
> cleanly. It is nice to be able to keep history around and use it.

Yes, it is nice to keep vendor history around, BUT:

CVS "vendor" branches are fundamentally incompatible with "normal"
branches in the same files/module (due to the way the "default" branch
must be managed to make vendor branches work properly), especially if
any important branch (eg. "-current") is in fact the trunk (because of
course a "cvs import" can immediately change the head revision of what's
checked out from the trunk and will thus distrupt everyone working on
the trunk.  CVS vendor branches are nowhere near as useful as was hinted
they might be in the original CVS paper.  They work great for a small
team managing stand-alone modules with frequent vendor imports with very
few local changes and no local branches, but that's about it.

If you really want to track vendor revisions to files which are part of
a larger collective set of modules then you should create a full,
normal, CVS branch for that sub-module and you should commit vendor
releases directly to that branch (i.e. work directly on that branch as
if you were the vendor working on a private branch) and do all merges to
other branches the normal "manual" way.

The CVS-style "vendor branch" should never ever have been introduced to
any files in any of NetBSD's repository.  It may even be worth while
writing a script to untangle the current mess in those files that do
now have vendor branches.

Once you've got vendor releases on their own normal CVS branch then once
again it's simplest just to do the standard "rm/add" to move a file --
since then you can fully track the moves on a per-branch basis.

> > As far as I'm concerned, disincentive to move files around would be a
> > positive thing.  8-)
> 
> I don't think so. Reorganizing the kernel sources, for instance, would
> be nice. The desire to move the filesystem related files and possibly
> reorganize portions of sys/arch by CPU type etc. seem quite
> reasonable, but are projects people have long avoided for fear of
> breaking the log revision history too badly.

While I agree rather strongly with Chris, it really doesn't matter.  So
long as CVS is being used (or anything even remotely like it using just
RCS or SCCS to track changes, i.e. anything without a complete way to
track not only file contents but also file locations is being used) to
manage the repository, then the whole issue is moot.

--

-- 
								Greg A. Woods

+1 416 218-0098;            <g.a.woods <at> ieee.org>;           <woods <at> robohack.ca>
Planix, Inc. <woods <at> planix.com>; VE3TCP; Secrets of the Weird <woods <at> weird.com>

TAKEMURA Shin | 3 Jan 2003 05:45
Picon

Re: new ioctl for touch panel calibration

I've just commited the change.
Thank you.

Takemura

----- Original Message ----- 
From: "TAKEMURA Shin" <takemura <at> netbsd.org>
To: <tech-kern <at> netbsd.org>
Sent: Monday, December 23, 2002 9:49 PM
Subject: new ioctl for touch panel calibration

> Hi all,
> 
> I'd like to add new ioctl on wsmouse for toch panel calibration.
> The calibration command tpctl(8) needs the ioctl to identify
> touch panel device because parameters of calibration are 
> unique for each device instance. The return data of the ioctl 
> shall contain vendor name, model name and serial number of 
> the device like this, "NEC MC-R530 SN00000000".
> (To tell the truth, real device can't tell it's serial number...)
> 
> Index: dev/wscons/wsconsio.h
> ===================================================================
> RCS file: /cvsroot/src/sys/dev/wscons/wsconsio.h,v
> retrieving revision 1.53
> diff -r1.53 wsconsio.h
> 209a210,219
> > /* get device id for calibration */
> > struct wsmouse_id {
> >       u_int type;
> >       u_int length;
> >       u_char data[WSMOUSE_ID_MAXLEN];
> > };
> > #define       WSMOUSE_ID_TYPE_UIDSTR  0
> > #define       WSMOUSE_ID_MAXLEN       256
> > #define       WSMOUSEIO_GETID         _IOWR('W', 38, struct wsmouse_id)
> 
> I will do the change next week if no one objects.
> Any comments?
> 
> Takemura


Gmane