* Bug encountered while comitting
From: Matthias Kestenholz @ 2006-03-24 18:39 UTC (permalink / raw)
To: git
Hello list,
I don't know if this is the right place to report a bug, but I'll
just try and see what comes back.
I am trying to build a Wiki [1] using PHP, a hacked version of Markdown,
and git for content tracking. I use the git core plumbing to do the
history work.
The PHP script created directories under .git/objects which were
only writable by www-data. There were other directories which were
owned by user mk and group www-data, and they were group writable.
So, I had write access to only a part of the .git directory.
When I tried to commit, I got a message saying "Unable to write sha1
filename".
The result was, that only part of the commit was recorded and that I
experienced repository corruption. refs/heads/master pointed to a
non-existant object.
The expected behavior would have been an error message telling me I
had insufficient write privileges and surely no repository
corruption.
Thanks,
Matthias
[1]: http://spinlock.ch/cgi-bin/gitweb.pl?p=swisdk2/bugs.git;a=tree
(See Wiki_ctrl.php for source)
--
:wq
^ permalink raw reply
* Re: Xen on Intel Yonah using VT
From: gimli @ 2006-03-24 18:39 UTC (permalink / raw)
To: gimli; +Cc: xen-devel
In-Reply-To: <44243354.7030907@dark-green.com>
Stupid me. Forget that mail from me.
I found the problem. The tun driver
was not loaded.
cu
Edgar (gimli) Hucek
gimli wrote:
> Hi.
>
> I run xen unstable from today with windows xp sp2 in a hvm domain.
> I tryed network types bridged and nat. It seems that no network
> traffic is comming out of windows. I play with problem now since
> 3 days with no result. What would be the best way to debug this
> problem.
>
> cu
>
> Edgar (gimli) Hucek
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
>
^ permalink raw reply
* Re: 2.6.16-mm1
From: Jens Axboe @ 2006-03-24 18:37 UTC (permalink / raw)
To: Andrew Morton; +Cc: Brandon Low, linux-kernel
In-Reply-To: <20060324103301.4e6c5a4b.akpm@osdl.org>
On Fri, Mar 24 2006, Andrew Morton wrote:
> Brandon Low <lostlogic@lostlogicx.com> wrote:
> >
> > On Fri, 03/24/06 at 03:39:34 -0800, Andrew Morton wrote:
> > > Brandon Low <lostlogic@lostlogicx.com> wrote:
> > > >
> > > > I hadn't noticed immediately in the ooops, but it is something to do
> > > > with the Hardware Abstraction Layer Daemon from http://freedesktop.org/Software/hal
> > > > I can't reproduce it without that daemon loaded either. I wonder if the
> > > > last accessed sysfs file mentioned in the oops (sda/size) is relevent
> > > > also.
> > > >
> > > > My exact steps (with hald loaded) are:
> > > > plug in ipod
> > > > mount /mnt/ipod
> > > > unzip -d /mnt/ipod rockbox.zip
> > > > eject /dev/sda
> > > > unplug ipod
> > > > immediately here, the oops prints.
> > >
> > > Still no joy, alas.
> > >
> > > git-cfq.patch plays with the elevator exit code for all IO schedulers.
> > > Would you be able to do
> > >
> > > wget ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.16/2.6.16-mm1/broken-out/git-cfq.patch
> > > patch -p1 -R < git-cfq.patch
> > >
> > > and retest?
> > >
> > > Thanks.
> >
> > It is definitely this patch. Identical steps (also used an untainted
> > kernel for both tests) on -mm1 with and without that patch, and when the
> > patch is reversed, I cannot cause the oops. I booted into single user
> > mode (to dodge tainting and any other weirdness), started the dbus
> > system message daemon and hald (which depends on dbus), then performed
> > the steps mentioned above.
> >
>
> Great. Thanks for working that out. It's time to add the dreaded Cc.
Can I see that oops?
--
Jens Axboe
^ permalink raw reply
* Re: 2.6.16-mm1
From: Andrew Morton @ 2006-03-24 18:33 UTC (permalink / raw)
To: Brandon Low; +Cc: linux-kernel, Jens Axboe
In-Reply-To: <20060324125817.GB3381@lostlogicx.com>
Brandon Low <lostlogic@lostlogicx.com> wrote:
>
> On Fri, 03/24/06 at 03:39:34 -0800, Andrew Morton wrote:
> > Brandon Low <lostlogic@lostlogicx.com> wrote:
> > >
> > > I hadn't noticed immediately in the ooops, but it is something to do
> > > with the Hardware Abstraction Layer Daemon from http://freedesktop.org/Software/hal
> > > I can't reproduce it without that daemon loaded either. I wonder if the
> > > last accessed sysfs file mentioned in the oops (sda/size) is relevent
> > > also.
> > >
> > > My exact steps (with hald loaded) are:
> > > plug in ipod
> > > mount /mnt/ipod
> > > unzip -d /mnt/ipod rockbox.zip
> > > eject /dev/sda
> > > unplug ipod
> > > immediately here, the oops prints.
> >
> > Still no joy, alas.
> >
> > git-cfq.patch plays with the elevator exit code for all IO schedulers.
> > Would you be able to do
> >
> > wget ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.16/2.6.16-mm1/broken-out/git-cfq.patch
> > patch -p1 -R < git-cfq.patch
> >
> > and retest?
> >
> > Thanks.
>
> It is definitely this patch. Identical steps (also used an untainted
> kernel for both tests) on -mm1 with and without that patch, and when the
> patch is reversed, I cannot cause the oops. I booted into single user
> mode (to dodge tainting and any other weirdness), started the dbus
> system message daemon and hald (which depends on dbus), then performed
> the steps mentioned above.
>
Great. Thanks for working that out. It's time to add the dreaded Cc.
^ permalink raw reply
* Re: [PATCH 2.6.16-mm1] cleanup __exit_signal->cleanup_sighand path
From: Suzanne Wood @ 2006-03-24 18:34 UTC (permalink / raw)
To: akpm, oleg; +Cc: kiran, linux-kernel, paulmck, suzannew
Thank you. This looks good. It clarifies the setting of tsk->sighand to NULL
before releasing siglock as you suggested earlier on LKML.
And it addresses all the occurrences in the mm-kernel of cleanup_sighand() to
become __cleanup_sighand() with the different argument -- paralleling the
__cleanup_signal().
The patch draws attention to __exit_signal() of fork.c and when the decremented
sig->count doesn't go to zero, the 'else' branch of the conditional, after
incrementing several counter fields of sig, sets sig to NULL to morph it
into a flag -- interesting.
Thanks.
Suzanne
> From Oleg Nesterov Thu Mar 23 10:59:36 2006
> This patch moves 'tsk->sighand = NULL' from cleanup_sighand() to
> __exit_signal(). This makes the exit path more understandable and
> allows us to do cleanup_sighand() outside of ->siglock protected
> section.
> Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
> --- MM/include/linux/sched.h~1_ESCS 2006-03-23 22:48:10.000000000 +0300
> +++ MM/include/linux/sched.h 2006-03-23 23:00:02.000000000 +0300
> @@ -1184,7 +1184,7 @@ extern void exit_thread(void);
>
> extern void exit_files(struct task_struct *);
> extern void __cleanup_signal(struct signal_struct *);
> -extern void cleanup_sighand(struct task_struct *);
> +extern void __cleanup_sighand(struct sighand_struct *);
> extern void exit_itimers(struct signal_struct *);
>
> extern NORET_TYPE void do_group_exit(int);
> --- MM/kernel/fork.c~1_ESCS 2006-03-23 22:48:10.000000000 +0300
> +++ MM/kernel/fork.c 2006-03-23 22:59:33.000000000 +0300
> @@ -808,12 +808,8 @@ static inline int copy_sighand(unsigned
> return 0;
> }
>
> -void cleanup_sighand(struct task_struct *tsk)
> +void __cleanup_sighand(struct sighand_struct *sighand)
> {
> - struct sighand_struct * sighand = tsk->sighand;
> -
> - /* Ok, we're done with the signal handlers */
> - tsk->sighand = NULL;
> if (atomic_dec_and_test(&sighand->count))
> kmem_cache_free(sighand_cachep, sighand);
> }
> @@ -1232,7 +1228,7 @@ bad_fork_cleanup_mm:
> bad_fork_cleanup_signal:
> cleanup_signal(p);
> bad_fork_cleanup_sighand:
> - cleanup_sighand(p);
> + __cleanup_sighand(p->sighand);
> bad_fork_cleanup_fs:
> exit_fs(p); /* blocking */
> bad_fork_cleanup_files:
> --- MM/kernel/exit.c~1_ESCS 2006-03-23 22:48:10.000000000 +0300
> +++ MM/kernel/exit.c 2006-03-23 23:02:53.000000000 +0300
> @@ -114,10 +114,11 @@ static void __exit_signal(struct task_st
> __unhash_process(tsk);
>
> tsk->signal = NULL;
> - cleanup_sighand(tsk);
> + tsk->sighand = NULL;
> spin_unlock(&sighand->siglock);
> rcu_read_unlock();
>
> + __cleanup_sighand(sighand);
> clear_tsk_thread_flag(tsk,TIF_SIGPENDING);
> flush_sigqueue(&tsk->pending);
> if (sig) {
^ permalink raw reply
* Re: [PATCH] powerpc: legacy_serial loop cleanup
From: Hollis Blanchard @ 2006-03-24 18:26 UTC (permalink / raw)
To: linuxppc-dev, mikey; +Cc: michael
In-Reply-To: <20060324041727.F131267B56@ozlabs.org>
On Thursday 23 March 2006 22:17, Michael Neuling wrote:
> We only ever execute the loop once, so let's move it to a function
> making it more readable. Cleanup patch, no functional change.
I don't understand: it's only used once, so make it a function? Why not just
change the "while" to an "if"?
Regardless, two style issues:
- remove the plain "return"
- reduce indenting like so:
if (console < 0)
return;
struct legacy_serial_info *info = ...
> Signed-off-by: Michael Neuling <mikey@neuling.org>
> ---
> arch/powerpc/kernel/legacy_serial.c | 39
+++++++++++++++++++-----------------
> 1 files changed, 21 insertions(+), 18 deletions(-)
>
> Index: linux-2.6-linus/arch/powerpc/kernel/legacy_serial.c
> ===================================================================
> --- linux-2.6-linus.orig/arch/powerpc/kernel/legacy_serial.c
> +++ linux-2.6-linus/arch/powerpc/kernel/legacy_serial.c
> @@ -236,6 +236,26 @@ static int __init add_legacy_pci_port(st
> }
> #endif
>
> +static void __init setup_legacy_serial_console(int console)
> +{
> + if (console >= 0) {
> + struct legacy_serial_info *info =
> + &legacy_serial_infos[legacy_serial_console];
> + void __iomem *addr;
> +
> + if (info->taddr == 0)
> + return;
> + addr = ioremap(info->taddr, 0x1000);
> + if (addr == NULL)
> + return;
> + if (info->speed == 0)
> + info->speed = udbg_probe_uart_speed(addr, info->clock);
> + DBG("default console speed = %d\n", info->speed);
> + udbg_init_uart(addr, info->speed, info->clock);
> + }
> + return;
> +}
> +
> /*
> * This is called very early, as part of setup_system() or eventually
> * setup_arch(), basically before anything else in this file. This function
> @@ -319,24 +339,7 @@ void __init find_legacy_serial_ports(voi
>
> DBG("legacy_serial_console = %d\n", legacy_serial_console);
>
> - /* udbg is 64 bits only for now, that will change soon though ... */
> - while (legacy_serial_console >= 0) {
> - struct legacy_serial_info *info =
> - &legacy_serial_infos[legacy_serial_console];
> - void __iomem *addr;
> -
> - if (info->taddr == 0)
> - break;
> - addr = ioremap(info->taddr, 0x1000);
> - if (addr == NULL)
> - break;
> - if (info->speed == 0)
> - info->speed = udbg_probe_uart_speed(addr, info->clock);
> - DBG("default console speed = %d\n", info->speed);
> - udbg_init_uart(addr, info->speed, info->clock);
> - break;
> - }
> -
> + setup_legacy_serial_console(legacy_serial_console);
> DBG(" <- find_legacy_serial_port()\n");
> }
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
>
^ permalink raw reply
* Re: [Xenomai-help] Crashing at boot with 2.6.15.4
From: Gilles Chanteperdrix @ 2006-03-24 18:34 UTC (permalink / raw)
To: Jan Kiszka; +Cc: xenomai
In-Reply-To: <4424264F.7090401@domain.hid>
Jan Kiszka wrote:
> Sean McGranaghan wrote:
> > FYI,
> >
> > Just following up on my crash issue from a couple weeks ago. It appears that
> > disabling the local APIC in the kernel fixed my crash. I have a complete dump of
> > the console messages before the crash and two kernel config files attached. The
> > only difference in the config files is the APIC settings.
> >
> > My test system is an older PII 350MHz with 512M. The vanilla kernel boots fine
> > with APIC support enabled, but when the Xenomai patches are applied I get the crash.
> >
> > Also, this may be in the release notes but I wanted to mention it anyway. I
> > noticed that the valid return values for an RTDM interrupt handler have changed
> > between Xenomai 2.0 and 2.1. I have a driver I wrote in 2.0.92 that fails to
> > compile under 2.1. It looks like the valid return code have changed as follows:
> >
> > Xenomai 2.0.92
> > RTDM_IRQ_PROPAGATE
> > RTDM_IRQ_ENABLE
> >
> > Xenomai 2.1
> > RTDM_IRQ_NONE
> > RTDM_IRQ_HANDLED
> >
> > When an interrupt handler now returns RTDM_IRQ_HANDLED I assume it will be
> > re-enabled, is this true?
>
> That's true, and it should be described, see RTDM API docs and
> ksrc/skins/rtdm/API.CHANGES. The upgrade is straightforward:
>
> old -> new
>
> 0 -> RTDM_IRQ_NONE
> RTDM_IRQ_ENABLE -> RTDM_IRQ_HANDLED
> RTDM_IRQ_PROPAGATE -> -unsupported-
>
> > Linux version 2.6.15.6-ipipe (smm@domain.hid) (gcc version 4.0.2 20051125 (Red Hat 4.0.2-8)) #3 Thu Mar 23 11:45:02 EST 2006
> > BIOS-provided physical RAM map:
> > BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
> > BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
> > BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)
> > BIOS-e820: 0000000000100000 - 000000001fffd000 (usable)
> > BIOS-e820: 000000001fffd000 - 000000001ffff000 (ACPI data)
> > BIOS-e820: 000000001ffff000 - 0000000020000000 (ACPI NVS)
> > BIOS-e820: 00000000ffff0000 - 0000000100000000 (reserved)
> > 0MB HIGHMEM available.
> > 511MB LOWMEM available.
> > DMI 2.0 present.
> > Allocating PCI resources starting at 30000000 (gap: 20000000:dfff0000)
> > Built 1 zonelists
> > Kernel command line: ro root=LABEL=/ console=ttyS0,115200n8
> > Local APIC disabled by BIOS -- you can enable it with "lapic"
>
> You may either follow this suggestion or actually leave local APIC off
> at compile time.
>
> > Initializing CPU#0
> > CPU 0 irqstacks, hard=c0414000 soft=c0413000
> > PID hash table entries: 2048 (order: 11, 32768 bytes)
> > Detected 350.905 MHz processor.
> > Using tsc for high-res timesource
> > I-pipe 1.2-01: pipeline enabled.
> > Console: colour VGA+ 80x25
> > Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
> > Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
> > Memory: 514088k/524276k available (2222k kernel code, 9656k reserved, 730k data, 168k init, 0k highmem)
> > Checking if this processor honours the WP bit even in supervisor mode... Ok.
> > Calibrating delay using timer specific routine.. 702.33 BogoMIPS (lpj=351169)
> > Security Framework v1.0.0 initialized
> > SELinux: Initializing.
> > SELinux: Starting in permissive mode
> > selinux_register_security: Registering secondary module capability
> > Capability LSM initialized as secondary
> > Mount-cache hash table entries: 512
> > CPU: L1 I cache: 16K, L1 D cache: 16K
> > CPU: L2 cache: 512K
> > Intel machine check architecture supported.
> > Intel machine check reporting enabled on CPU#0.
> > mtrr: v2.0 (20020519)
> > CPU: Intel Pentium II (Deschutes) stepping 02
> > Enabling fast FPU save and restore... done.
> > Checking 'hlt' instruction... OK.
> > checking if image is initramfs... it is
> > Freeing initrd memory: 1070k freed
> > NET: Registered protocol family 16
> > PCI: PCI BIOS revision 2.10 entry at 0xf0720, last bus=1
> > PCI: Using configuration type 1
> > Linux Plug and Play Support v0.97 (c) Adam Belay
> > SCSI subsystem initialized
> > usbcore: registered new driver usbfs
> > usbcore: registered new driver hub
> > PCI: Probing PCI hardware
> > PCI quirk: region e400-e43f claimed by PIIX4 ACPI
> > PCI quirk: region e800-e80f claimed by PIIX4 SMB
> > PIIX4 devres B PIO at 0290-0297
> > PCI: Using IRQ router PIIX/ICH [8086/7110] at 0000:00:04.0
> > PCI: IRQ 0 for device 0000:00:04.2 doesn't match PIRQ mask - try pci=usepirqmask
> > PCI: Bridge: 0000:00:01.0
> > IO window: disabled.
> > MEM window: e0000000-e1dfffff
> > PREFETCH window: e1f00000-e3ffffff
> > audit: initializing netlink socket (disabled)
> > audit(1143117255.879:1): initialized
> > Xenomai: Local APIC absent or disabled!
> > Disable APIC support or pass "lapic=1" as bootparam.
> > Xenomai: system init failed, code -19.
>
> This is normal, given the lacking "lapic=1".
>
> > divide error: 0000 [#1]
> > Modules linked in:
> > CPU: 0
> > EIP: 0060:[<c014243a>] Not tainted VLI
> > EFLAGS: 00010246 (2.6.15.6-ipipe)
> > EIP is at xntimer_get_jiffies_aperiodic+0x5a/0xf0
>
> This is not ok, but should be easy to fix.
I am able to reproduce that bug, trying to fix...
--
Gilles Chanteperdrix.
^ permalink raw reply
* Re: [2.6 patch] let x86 subarchs select SMP
From: Roman Zippel @ 2006-03-24 18:30 UTC (permalink / raw)
To: Adrian Bunk; +Cc: Andrew Morton, linux-kernel
In-Reply-To: <20060324165613.GF22727@stusta.de>
Hi,
On Fri, 24 Mar 2006, Adrian Bunk wrote:
> The SMP question comes after the subarch question, and it does therefore
> make sense to let the SMP-only subarchs select SMP instead of depending
> on it.
No, it doesn't make sense. If the ordering is wrong, fix the ordering, but
that's a silly reason to use select.
bye, Roman
^ permalink raw reply
* Re: 2.6.16-mm1 grub oddness
From: Andrew Morton @ 2006-03-24 18:25 UTC (permalink / raw)
To: Mike Galbraith; +Cc: linux-kernel
In-Reply-To: <1143201413.7741.53.camel@homer>
Mike Galbraith <efault@gmx.de> wrote:
>
> Greetings,
>
> I'm seeing strange things with grub with this kernel. After my box has
> been up for a while, and I reboot, selecting a kernel to restart, upon
> reboot, I sometimes (fairly often) get a blank screen staring at me
> though I see grub doing it's thing. Poking the power button results in
> an immediate poweroff, not as if the kernel had panicked or whatnot very
> early in boot. Very odd, and never before seen.
>
Do you mean that grub is actually proceeding as expected, just that the
display is off? If so, does it ever come back on?
Would it be reasonable to guess that some piece of code on the reboot path
is now poking the display hardware in a manner which shuts it off?
Are you using an fbdev driver? If so, which?
^ permalink raw reply
* Linux booting problem
From: Segin @ 2006-03-24 19:24 UTC (permalink / raw)
To: linux-kernel
I am having a problem booting *any* modern version of Linux on y Compaq
Presario CDS 520. It keeps having a kernel panic after trying to read a
compressed ramdisk (for floppy-based boots, which is all I can try, the
system was made before el-torito became standard).
All kernel panics produce similar output, the most recent from 2.0.31 is:
divide error: 0000
CPU: 0
EIP: 0010:[<0017f803>]
EFLAGS: 00000246
eax: 00000035 ebx: 00000010 ecx: 00000008 edx: 00000e52
... and some other stuff, the system's APM went active and it locked up,
but it also did say "panic: tried to kill init!".
I have tried many kernel version from 2.0.0 up to the latest release.
All of them exibit the same behaviour and divine error. The system has
no FPU, and 'no387' is used as a kernel option. All custom kernels have
math emulation ENABLED.
As a side note, Linux 0.99.15 boots just fine using loadlin.
^ permalink raw reply
* Re: [PATCH][0/8] (Targeting 2.6.17) Posix memory locking and balanced mlock-LRU semantic
From: Nick Piggin @ 2006-03-24 16:57 UTC (permalink / raw)
To: Stone Wang; +Cc: akpm, linux-kernel, linux-mm
In-Reply-To: <bc56f2f0603240705y3b4abe3ej@mail.gmail.com>
Stone Wang wrote:
> 2006/3/21, Nick Piggin <nickpiggin@yahoo.com.au>:
>>In what way are we not now posix compliant now?
>
>
> Currently, Linux's mlock for example, may fail with only part of its
> task finished.
>
> While accroding to POSIX definition:
>
> man mlock(2)
>
> "
> RETURN VALUE
> On success, mlock returns zero. On error, -1 is returned, errno is set
> appropriately, and no changes are made to any locks in the address
> space of the process.
> "
>
Looks like you're right, so good catch. You should probably try to submit your
posix mlock patch by itself then. Make sure you look at the coding standards
though, and try to _really_ follow coding conventions of the file you're
modifying.
You also should make sure the patch works standalone (ie. not just as part of
a set). Oh, and introducing a new field in vma for a flag is probably not the
best option if you still have room in the vm_flags field.
And the patch changelog should contain the actual problem, and quote the
relevant part of the POSIX definition, if applicable.
Thanks,
Nick
--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com
^ permalink raw reply
* Re: [PATCH][5/8] proc: export mlocked pages info through "/proc/meminfo: Wired"
From: Nick Piggin @ 2006-03-24 18:25 UTC (permalink / raw)
To: Rik van Riel; +Cc: Stone Wang, akpm, linux-kernel, linux-mm
In-Reply-To: <Pine.LNX.4.63.0603241319130.30426@cuia.boston.redhat.com>
Rik van Riel wrote:
> On Sat, 25 Mar 2006, Nick Piggin wrote:
>
>>Rik van Riel wrote:
>>
>>>On Wed, 22 Mar 2006, Nick Piggin wrote:
>>>
>>>
>>>>Why would you want to ever do something like that though? I don't think
>>>>you should use this name "just in case", unless you have some really good
>>>>potential usage in mind.
>>>
>>>ramfs
>>
>>Why would ramfs want its pages in this wired list? (I'm not so
>>familiar with it but I can't think of a reason).
>
>
> Because ramfs pages cannot be paged out, which makes them locked
> into memory the same way mlocked pages are.
>
I don't understand why they need to be on any list though,
that isn't an internal ramfs specific structure (ie. not
the just-in-case wired list).
--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* Re: Errors GITtifying GCC and Binutils
From: Jan-Benedict Glaw @ 2006-03-24 18:25 UTC (permalink / raw)
To: git
In-Reply-To: <20060322133337.GU20746@lug-owl.de>
[-- Attachment #1: Type: text/plain, Size: 4040 bytes --]
On Wed, 2006-03-22 14:33:37 +0100, Jan-Benedict Glaw <jbglaw@lug-owl.de> wrote:
Since it seems nobody looked at the GCC import run (which means to use
the svnimport), I ran it again, under strace control:
> GCC
> ~~~
> $ /home/jbglaw/bin/git svnimport -C gcc -v svn://gcc.gnu.org/svn/gcc
> Committed change 3936:/ 1993-03-31 05:44:03)
> Commit ID ceff85145f8671fb2a9d826a761cedc2a507bd1e
> Writing to refs/heads/origin
> DONE: 3936 origin ceff85145f8671fb2a9d826a761cedc2a507bd1e
> ... 3937 trunk/gcc/final.c ...
> Can't fork at /home/jbglaw/bin/git-svnimport line 379.
... 4279 trunk/gcc/config/i386/xm-sco.h ...
This time it broke at a different revision, so I guess it's not a SVN
or git / git-svnimport problem, but rather a problem of my Perl
installation or the kernel itself?
Tree ID 5b04fbc98f8dc9d50506b6dbc8f31567eea2e225
Committed change 4279:/ 1993-04-29 21:13:46)
Merge parent branch: eeb742d8ffd78d58f05d0b9c80bb55e1dc25ad13
Commit ID e85129f5e8af0b93a41d5bf294f17a9c9bf9fa21
Writing to refs/heads/origin
DONE: 4279 origin e85129f5e8af0b93a41d5bf294f17a9c9bf9fa21
... 4280 trunk/gcc/config/mips/mips.h ...
Tree ID 3feb45ec3ee93e8a6d75b8ce552281e0ed2d7215
Committed change 4280:/ 1993-04-30 00:53:35)
Merge parent branch: e85129f5e8af0b93a41d5bf294f17a9c9bf9fa21
Commit ID 34b473ffc0e05419c50be848d5349592b7c48ee3
Writing to refs/heads/origin
DONE: 4280 origin 34b473ffc0e05419c50be848d5349592b7c48ee3
readline() on closed filehandle H at /home/jbglaw/bin/git-svnimport line 562.
4281: cannot find commit 'origin'!
readline() on closed filehandle H at /home/jbglaw/bin/git-svnimport line 562.
4282: cannot find commit 'origin'!
readline() on closed filehandle H at /home/jbglaw/bin/git-svnimport line 562.
4283: cannot find commit 'origin'!
readline() on closed filehandle H at /home/jbglaw/bin/git-svnimport line 562.
4284: cannot find commit 'origin'!
readline() on closed filehandle H at /home/jbglaw/bin/git-svnimport line 562.
4285: cannot find commit 'origin'!
... 4286 trunk/gcc/fixincludes ...
Can't fork at /home/jbglaw/bin/git-svnimport line 379.
strace of this:
read(3, "rintf decl"..., 4096) = 2896
write(6, "superfluou"..., 4096) = 4096
read(3, "$file ${LI"..., 4096) = 1448
read(3, "m -f ${LIB"..., 4096) = 1448
read(3, "LIB}/machi"..., 4096) = 1448
write(6, " 2>/dev/nu"..., 4096) = 4096
read(3, "memory\\.h"..., 4096) = 2896
read(3, "h>\") > ${"..., 4096) = 1448
write(6, "&& [ ! -r "..., 4096) = 4096
read(3, " char *__n"..., 4096) = 3438
write(6, "claim to h"..., 4096) = 4096
write(6, "ymbolic no"..., 446) = 446
close(6) = 0
pipe([6, 7]) = 0
clone(child_stack=0,
flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
child_tidptr=0xb7ddf708) = -1 ENOMEM (Cannot allocate memory)
close(6) = 0
close(7) = 0
write(2, "Can\'t for"..., 55) = 55
close(4) = 0
close(3) = 0
What are possible reasons for clone() to fail with -ENOMEN? I have to
admit that the box _is_ loaded a bit all the time:
jbglaw@bixie:~/vax/git-conversion$ uptime
19:23:58 up 136 days, 7:46, 20 users, load average: 4.45, 4.25, 3.05
jbglaw@bixie:~/vax/git-conversion$ free
total used free shared buffers cached
Mem: 507308 501760 5548 0 2184 16900
-/+ buffers/cache: 482676 24632
Swap: 2441872 1295512 1146360
MfG, JBG
--
Jan-Benedict Glaw jbglaw@lug-owl.de . +49-172-7608481 _ O _
"Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg _ _ O
für einen Freien Staat voll Freier Bürger" | im Internet! | im Irak! O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* [ALSA - driver 0001898]: no sound from headphones or speakers on asus a6km laptop
From: bugtrack @ 2006-03-24 18:22 UTC (permalink / raw)
To: alsa-devel
A NOTE has been added to this issue.
======================================================================
<https://bugtrack.alsa-project.org/alsa-bug/view.php?id=1898>
======================================================================
Reported By: kiwi
Assigned To:
======================================================================
Project: ALSA - driver
Issue ID: 1898
Category: PCI - intel8x0
Reproducibility: always
Severity: major
Priority: normal
Status: new
Distribution: Fedora Core 5 test3
Kernel Version: 2.6.15-1.2009.4.2_FC5
======================================================================
Date Submitted: 03-09-2006 00:30 CET
Last Modified: 03-24-2006 19:22 CET
======================================================================
Summary: no sound from headphones or speakers on asus a6km
laptop
Description:
The headphone port and the speakers just don't work. Seems like there is
some control hidden in the mixer which is muted.
By setting the master and pcm volume at 100% I can hear just some static
on song beats only on headphones. Speakers always stay mute.
I can only get sound by attaching the headphones to line-in and enabling
"shared" surround mode.
Same issues with a knoppix 4.0.2.
======================================================================
----------------------------------------------------------------------
lbenini - 03-23-06 13:59
----------------------------------------------------------------------
This works for me:
"With alsamixer, select "Duplicate front", unmute Surround 3D and use it
if it were the Master Control. Bring the Channels to 4 or 6 and then plug
your headphones in line-in. It worked for me, even if I am still not able
to hear any sound from the built-in speakers. "
Copied from
http://forum.hardware.fr/hardwarefr/MiniPCPortablesPDA/Asus-A6K-MT30-Install-Win-Nux-cours-sujet-17894-4.htm
Without this problem remains with 2.6.16-git6 (alsa in kernel)
and/or with alsa 1.0.11rc4
----------------------------------------------------------------------
kiwi - 03-24-06 19:22
----------------------------------------------------------------------
It works for me too, I already said that in the original bugreport.
Issue History
Date Modified Username Field Change
======================================================================
03-09-06 00:30 kiwi New Issue
03-09-06 00:30 kiwi Distribution => Fedora Core 5 test3
03-09-06 00:30 kiwi Kernel Version => 2.6.15-1.2009.4.2_FC5
03-09-06 16:26 kiwi Issue Monitored: kiwi
03-09-06 16:41 kiwi Note Added: 0008391
03-09-06 20:09 michele26x1 Note Added: 0008396
03-09-06 21:02 kiwi Note Added: 0008397
03-11-06 14:35 hongqn Issue Monitored: hongqn
03-12-06 15:49 kiwi Note Added: 0008432
03-12-06 16:40 Rollsappletree Note Added: 0008433
03-13-06 10:10 u238 Note Added: 0008439
03-13-06 10:11 u238 Note Edited: 0008439
03-13-06 10:12 u238 Note Edited: 0008439
03-13-06 23:59 lbenini Note Added: 0008469
03-23-06 13:56 lbenini Note Added: 0008881
03-23-06 13:59 lbenini Note Edited: 0008881
03-24-06 19:22 kiwi Note Added: 0008934
======================================================================
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
^ permalink raw reply
* Re: [PATCH][5/8] proc: export mlocked pages info through "/proc/meminfo: Wired"
From: Rik van Riel @ 2006-03-24 18:19 UTC (permalink / raw)
To: Nick Piggin; +Cc: Stone Wang, akpm, linux-kernel, linux-mm
In-Reply-To: <442420A2.80807@yahoo.com.au>
On Sat, 25 Mar 2006, Nick Piggin wrote:
> Rik van Riel wrote:
> > On Wed, 22 Mar 2006, Nick Piggin wrote:
> >
> > > Why would you want to ever do something like that though? I don't think
> > > you should use this name "just in case", unless you have some really good
> > > potential usage in mind.
> >
> > ramfs
>
> Why would ramfs want its pages in this wired list? (I'm not so
> familiar with it but I can't think of a reason).
Because ramfs pages cannot be paged out, which makes them locked
into memory the same way mlocked pages are.
--
All Rights Reversed
^ permalink raw reply
* Re: [PATCH][5/8] proc: export mlocked pages info through "/proc/meminfo: Wired"
From: Rik van Riel @ 2006-03-24 18:19 UTC (permalink / raw)
To: Nick Piggin; +Cc: Stone Wang, akpm, linux-kernel, linux-mm
In-Reply-To: <442420A2.80807@yahoo.com.au>
On Sat, 25 Mar 2006, Nick Piggin wrote:
> Rik van Riel wrote:
> > On Wed, 22 Mar 2006, Nick Piggin wrote:
> >
> > > Why would you want to ever do something like that though? I don't think
> > > you should use this name "just in case", unless you have some really good
> > > potential usage in mind.
> >
> > ramfs
>
> Why would ramfs want its pages in this wired list? (I'm not so
> familiar with it but I can't think of a reason).
Because ramfs pages cannot be paged out, which makes them locked
into memory the same way mlocked pages are.
--
All Rights Reversed
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* [PATCH 7/16] UML - Move sigio_user.c to os-Linux/sigio.c
From: Jeff Dike @ 2006-03-24 18:14 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, user-mode-linux-devel, Gennady Sharapov
The serial UML OS-abstraction layer patch (um/kernel dir).
This moves sigio_user.c to os-Linux dir
Signed-off-by: Gennady Sharapov <Gennady.V.Sharapov@intel.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Index: linux-2.6.16/arch/um/include/os.h
===================================================================
--- linux-2.6.16.orig/arch/um/include/os.h 2006-03-23 17:23:54.000000000 -0500
+++ linux-2.6.16/arch/um/include/os.h 2006-03-23 17:26:25.000000000 -0500
@@ -311,4 +311,9 @@ extern void os_set_pollfd(int i, int fd)
extern void os_set_ioignore(void);
extern void init_irq_signals(int on_sigstack);
+/* sigio.c */
+extern void write_sigio_workaround(void);
+extern int add_sigio_fd(int fd, int read);
+extern int ignore_sigio_fd(int fd);
+
#endif
Index: linux-2.6.16/arch/um/include/sigio.h
===================================================================
--- linux-2.6.16.orig/arch/um/include/sigio.h 2006-03-23 17:23:54.000000000 -0500
+++ linux-2.6.16/arch/um/include/sigio.h 2006-03-23 17:26:25.000000000 -0500
@@ -8,8 +8,6 @@
extern int write_sigio_irq(int fd);
extern int register_sigio_fd(int fd);
-extern int add_sigio_fd(int fd, int read);
-extern int ignore_sigio_fd(int fd);
extern void sigio_lock(void);
extern void sigio_unlock(void);
Index: linux-2.6.16/arch/um/include/user_util.h
===================================================================
--- linux-2.6.16.orig/arch/um/include/user_util.h 2006-03-23 17:15:05.000000000 -0500
+++ linux-2.6.16/arch/um/include/user_util.h 2006-03-23 17:26:25.000000000 -0500
@@ -58,7 +58,6 @@ extern int attach(int pid);
extern void kill_child_dead(int pid);
extern int cont(int pid);
extern void check_sigio(void);
-extern void write_sigio_workaround(void);
extern void arch_check_bugs(void);
extern int cpu_feature(char *what, char *buf, int len);
extern int arch_handle_signal(int sig, union uml_pt_regs *regs);
Index: linux-2.6.16/arch/um/kernel/Makefile
===================================================================
--- linux-2.6.16.orig/arch/um/kernel/Makefile 2006-03-23 17:15:05.000000000 -0500
+++ linux-2.6.16/arch/um/kernel/Makefile 2006-03-23 17:26:25.000000000 -0500
@@ -8,7 +8,7 @@ clean-files :=
obj-y = config.o exec_kern.o exitcode.o \
init_task.o irq.o ksyms.o mem.o physmem.o \
- process_kern.o ptrace.o reboot.o resource.o sigio_user.o sigio_kern.o \
+ process_kern.o ptrace.o reboot.o resource.o sigio_kern.o \
signal_kern.o smp.o syscall_kern.o sysrq.o \
time_kern.o tlb.o trap_kern.o uaccess.o um_arch.o umid.o
Index: linux-2.6.16/arch/um/os-Linux/Makefile
===================================================================
--- linux-2.6.16.orig/arch/um/os-Linux/Makefile 2006-03-23 17:15:05.000000000 -0500
+++ linux-2.6.16/arch/um/os-Linux/Makefile 2006-03-23 17:26:25.000000000 -0500
@@ -3,14 +3,15 @@
# Licensed under the GPL
#
-obj-y = aio.o elf_aux.o file.o helper.o irq.o main.o mem.o process.o signal.o \
- start_up.o time.o trap.o tt.o tty.o uaccess.o umid.o user_syms.o \
- util.o drivers/ sys-$(SUBARCH)/
+obj-y = aio.o elf_aux.o file.o helper.o irq.o main.o mem.o process.o sigio.o \
+ signal.o start_up.o time.o trap.o tt.o tty.o uaccess.o umid.o \
+ user_syms.o util.o drivers/ sys-$(SUBARCH)/
obj-$(CONFIG_MODE_SKAS) += skas/
USER_OBJS := aio.o elf_aux.o file.o helper.o irq.o main.o mem.o process.o \
- signal.o start_up.o time.o trap.o tt.o tty.o uaccess.o umid.o util.o
+ sigio.o signal.o start_up.o time.o trap.o tt.o tty.o uaccess.o umid.o \
+ util.o
elf_aux.o: $(ARCH_DIR)/kernel-offsets.h
CFLAGS_elf_aux.o += -I$(objtree)/arch/um
Index: linux-2.6.16/arch/um/os-Linux/sigio.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.16/arch/um/os-Linux/sigio.c 2006-03-23 17:30:27.000000000 -0500
@@ -0,0 +1,324 @@
+/*
+ * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
+ * Licensed under the GPL
+ */
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <termios.h>
+#include <pty.h>
+#include <signal.h>
+#include <errno.h>
+#include <string.h>
+#include <sched.h>
+#include <sys/socket.h>
+#include <sys/poll.h>
+#include "init.h"
+#include "user.h"
+#include "kern_util.h"
+#include "user_util.h"
+#include "sigio.h"
+#include "os.h"
+
+/* Protected by sigio_lock(), also used by sigio_cleanup, which is an
+ * exitcall.
+ */
+static int write_sigio_pid = -1;
+
+/* These arrays are initialized before the sigio thread is started, and
+ * the descriptors closed after it is killed. So, it can't see them change.
+ * On the UML side, they are changed under the sigio_lock.
+ */
+static int write_sigio_fds[2] = { -1, -1 };
+static int sigio_private[2] = { -1, -1 };
+
+struct pollfds {
+ struct pollfd *poll;
+ int size;
+ int used;
+};
+
+/* Protected by sigio_lock(). Used by the sigio thread, but the UML thread
+ * synchronizes with it.
+ */
+struct pollfds current_poll = {
+ .poll = NULL,
+ .size = 0,
+ .used = 0
+};
+
+struct pollfds next_poll = {
+ .poll = NULL,
+ .size = 0,
+ .used = 0
+};
+
+static int write_sigio_thread(void *unused)
+{
+ struct pollfds *fds, tmp;
+ struct pollfd *p;
+ int i, n, respond_fd;
+ char c;
+
+ signal(SIGWINCH, SIG_IGN);
+ fds = ¤t_poll;
+ while(1){
+ n = poll(fds->poll, fds->used, -1);
+ if(n < 0){
+ if(errno == EINTR) continue;
+ printk("write_sigio_thread : poll returned %d, "
+ "errno = %d\n", n, errno);
+ }
+ for(i = 0; i < fds->used; i++){
+ p = &fds->poll[i];
+ if(p->revents == 0) continue;
+ if(p->fd == sigio_private[1]){
+ n = os_read_file(sigio_private[1], &c, sizeof(c));
+ if(n != sizeof(c))
+ printk("write_sigio_thread : "
+ "read failed, err = %d\n", -n);
+ tmp = current_poll;
+ current_poll = next_poll;
+ next_poll = tmp;
+ respond_fd = sigio_private[1];
+ }
+ else {
+ respond_fd = write_sigio_fds[1];
+ fds->used--;
+ memmove(&fds->poll[i], &fds->poll[i + 1],
+ (fds->used - i) * sizeof(*fds->poll));
+ }
+
+ n = os_write_file(respond_fd, &c, sizeof(c));
+ if(n != sizeof(c))
+ printk("write_sigio_thread : write failed, "
+ "err = %d\n", -n);
+ }
+ }
+
+ return 0;
+}
+
+static int need_poll(int n)
+{
+ if(n <= next_poll.size){
+ next_poll.used = n;
+ return(0);
+ }
+ kfree(next_poll.poll);
+ next_poll.poll = um_kmalloc_atomic(n * sizeof(struct pollfd));
+ if(next_poll.poll == NULL){
+ printk("need_poll : failed to allocate new pollfds\n");
+ next_poll.size = 0;
+ next_poll.used = 0;
+ return(-1);
+ }
+ next_poll.size = n;
+ next_poll.used = n;
+ return(0);
+}
+
+/* Must be called with sigio_lock held, because it's needed by the marked
+ * critical section. */
+static void update_thread(void)
+{
+ unsigned long flags;
+ int n;
+ char c;
+
+ flags = set_signals(0);
+ n = os_write_file(sigio_private[0], &c, sizeof(c));
+ if(n != sizeof(c)){
+ printk("update_thread : write failed, err = %d\n", -n);
+ goto fail;
+ }
+
+ n = os_read_file(sigio_private[0], &c, sizeof(c));
+ if(n != sizeof(c)){
+ printk("update_thread : read failed, err = %d\n", -n);
+ goto fail;
+ }
+
+ set_signals(flags);
+ return;
+ fail:
+ /* Critical section start */
+ if(write_sigio_pid != -1)
+ os_kill_process(write_sigio_pid, 1);
+ write_sigio_pid = -1;
+ close(sigio_private[0]);
+ close(sigio_private[1]);
+ close(write_sigio_fds[0]);
+ close(write_sigio_fds[1]);
+ /* Critical section end */
+ set_signals(flags);
+}
+
+int add_sigio_fd(int fd, int read)
+{
+ int err = 0, i, n, events;
+
+ sigio_lock();
+ for(i = 0; i < current_poll.used; i++){
+ if(current_poll.poll[i].fd == fd)
+ goto out;
+ }
+
+ n = current_poll.used + 1;
+ err = need_poll(n);
+ if(err)
+ goto out;
+
+ for(i = 0; i < current_poll.used; i++)
+ next_poll.poll[i] = current_poll.poll[i];
+
+ if(read) events = POLLIN;
+ else events = POLLOUT;
+
+ next_poll.poll[n - 1] = ((struct pollfd) { .fd = fd,
+ .events = events,
+ .revents = 0 });
+ update_thread();
+ out:
+ sigio_unlock();
+ return(err);
+}
+
+int ignore_sigio_fd(int fd)
+{
+ struct pollfd *p;
+ int err = 0, i, n = 0;
+
+ sigio_lock();
+ for(i = 0; i < current_poll.used; i++){
+ if(current_poll.poll[i].fd == fd) break;
+ }
+ if(i == current_poll.used)
+ goto out;
+
+ err = need_poll(current_poll.used - 1);
+ if(err)
+ goto out;
+
+ for(i = 0; i < current_poll.used; i++){
+ p = ¤t_poll.poll[i];
+ if(p->fd != fd) next_poll.poll[n++] = current_poll.poll[i];
+ }
+ if(n == i){
+ printk("ignore_sigio_fd : fd %d not found\n", fd);
+ err = -1;
+ goto out;
+ }
+
+ update_thread();
+ out:
+ sigio_unlock();
+ return(err);
+}
+
+static struct pollfd *setup_initial_poll(int fd)
+{
+ struct pollfd *p;
+
+ p = um_kmalloc(sizeof(struct pollfd));
+ if (p == NULL) {
+ printk("setup_initial_poll : failed to allocate poll\n");
+ return NULL;
+ }
+ *p = ((struct pollfd) { .fd = fd,
+ .events = POLLIN,
+ .revents = 0 });
+ return p;
+}
+
+void write_sigio_workaround(void)
+{
+ unsigned long stack;
+ struct pollfd *p;
+ int err;
+ int l_write_sigio_fds[2];
+ int l_sigio_private[2];
+ int l_write_sigio_pid;
+
+ /* We call this *tons* of times - and most ones we must just fail. */
+ sigio_lock();
+ l_write_sigio_pid = write_sigio_pid;
+ sigio_unlock();
+
+ if (l_write_sigio_pid != -1)
+ return;
+
+ err = os_pipe(l_write_sigio_fds, 1, 1);
+ if(err < 0){
+ printk("write_sigio_workaround - os_pipe 1 failed, "
+ "err = %d\n", -err);
+ return;
+ }
+ err = os_pipe(l_sigio_private, 1, 1);
+ if(err < 0){
+ printk("write_sigio_workaround - os_pipe 2 failed, "
+ "err = %d\n", -err);
+ goto out_close1;
+ }
+
+ p = setup_initial_poll(l_sigio_private[1]);
+ if(!p)
+ goto out_close2;
+
+ sigio_lock();
+
+ /* Did we race? Don't try to optimize this, please, it's not so likely
+ * to happen, and no more than once at the boot. */
+ if(write_sigio_pid != -1)
+ goto out_unlock;
+
+ write_sigio_pid = run_helper_thread(write_sigio_thread, NULL,
+ CLONE_FILES | CLONE_VM, &stack, 0);
+
+ if (write_sigio_pid < 0)
+ goto out_clear;
+
+ if (write_sigio_irq(l_write_sigio_fds[0]))
+ goto out_kill;
+
+ /* Success, finally. */
+ memcpy(write_sigio_fds, l_write_sigio_fds, sizeof(l_write_sigio_fds));
+ memcpy(sigio_private, l_sigio_private, sizeof(l_sigio_private));
+
+ current_poll = ((struct pollfds) { .poll = p,
+ .used = 1,
+ .size = 1 });
+
+ sigio_unlock();
+ return;
+
+ out_kill:
+ l_write_sigio_pid = write_sigio_pid;
+ write_sigio_pid = -1;
+ sigio_unlock();
+ /* Going to call waitpid, avoid holding the lock. */
+ os_kill_process(l_write_sigio_pid, 1);
+ goto out_free;
+
+ out_clear:
+ write_sigio_pid = -1;
+ out_unlock:
+ sigio_unlock();
+ out_free:
+ kfree(p);
+ out_close2:
+ close(l_sigio_private[0]);
+ close(l_sigio_private[1]);
+ out_close1:
+ close(l_write_sigio_fds[0]);
+ close(l_write_sigio_fds[1]);
+ return;
+}
+
+void sigio_cleanup(void)
+{
+ if(write_sigio_pid != -1){
+ os_kill_process(write_sigio_pid, 1);
+ write_sigio_pid = -1;
+ }
+}
Index: linux-2.6.16/arch/um/kernel/sigio_user.c
===================================================================
--- linux-2.6.16.orig/arch/um/kernel/sigio_user.c 2006-03-23 17:25:36.000000000 -0500
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,324 +0,0 @@
-/*
- * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
- * Licensed under the GPL
- */
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <termios.h>
-#include <pty.h>
-#include <signal.h>
-#include <errno.h>
-#include <string.h>
-#include <sched.h>
-#include <sys/socket.h>
-#include <sys/poll.h>
-#include "init.h"
-#include "user.h"
-#include "kern_util.h"
-#include "user_util.h"
-#include "sigio.h"
-#include "os.h"
-
-/* Protected by sigio_lock(), also used by sigio_cleanup, which is an
- * exitcall.
- */
-static int write_sigio_pid = -1;
-
-/* These arrays are initialized before the sigio thread is started, and
- * the descriptors closed after it is killed. So, it can't see them change.
- * On the UML side, they are changed under the sigio_lock.
- */
-static int write_sigio_fds[2] = { -1, -1 };
-static int sigio_private[2] = { -1, -1 };
-
-struct pollfds {
- struct pollfd *poll;
- int size;
- int used;
-};
-
-/* Protected by sigio_lock(). Used by the sigio thread, but the UML thread
- * synchronizes with it.
- */
-struct pollfds current_poll = {
- .poll = NULL,
- .size = 0,
- .used = 0
-};
-
-struct pollfds next_poll = {
- .poll = NULL,
- .size = 0,
- .used = 0
-};
-
-static int write_sigio_thread(void *unused)
-{
- struct pollfds *fds, tmp;
- struct pollfd *p;
- int i, n, respond_fd;
- char c;
-
- signal(SIGWINCH, SIG_IGN);
- fds = ¤t_poll;
- while(1){
- n = poll(fds->poll, fds->used, -1);
- if(n < 0){
- if(errno == EINTR) continue;
- printk("write_sigio_thread : poll returned %d, "
- "errno = %d\n", n, errno);
- }
- for(i = 0; i < fds->used; i++){
- p = &fds->poll[i];
- if(p->revents == 0) continue;
- if(p->fd == sigio_private[1]){
- n = os_read_file(sigio_private[1], &c, sizeof(c));
- if(n != sizeof(c))
- printk("write_sigio_thread : "
- "read failed, err = %d\n", -n);
- tmp = current_poll;
- current_poll = next_poll;
- next_poll = tmp;
- respond_fd = sigio_private[1];
- }
- else {
- respond_fd = write_sigio_fds[1];
- fds->used--;
- memmove(&fds->poll[i], &fds->poll[i + 1],
- (fds->used - i) * sizeof(*fds->poll));
- }
-
- n = os_write_file(respond_fd, &c, sizeof(c));
- if(n != sizeof(c))
- printk("write_sigio_thread : write failed, "
- "err = %d\n", -n);
- }
- }
-
- return 0;
-}
-
-static int need_poll(int n)
-{
- if(n <= next_poll.size){
- next_poll.used = n;
- return(0);
- }
- kfree(next_poll.poll);
- next_poll.poll = um_kmalloc_atomic(n * sizeof(struct pollfd));
- if(next_poll.poll == NULL){
- printk("need_poll : failed to allocate new pollfds\n");
- next_poll.size = 0;
- next_poll.used = 0;
- return(-1);
- }
- next_poll.size = n;
- next_poll.used = n;
- return(0);
-}
-
-/* Must be called with sigio_lock held, because it's needed by the marked
- * critical section. */
-static void update_thread(void)
-{
- unsigned long flags;
- int n;
- char c;
-
- flags = set_signals(0);
- n = os_write_file(sigio_private[0], &c, sizeof(c));
- if(n != sizeof(c)){
- printk("update_thread : write failed, err = %d\n", -n);
- goto fail;
- }
-
- n = os_read_file(sigio_private[0], &c, sizeof(c));
- if(n != sizeof(c)){
- printk("update_thread : read failed, err = %d\n", -n);
- goto fail;
- }
-
- set_signals(flags);
- return;
- fail:
- /* Critical section start */
- if(write_sigio_pid != -1)
- os_kill_process(write_sigio_pid, 1);
- write_sigio_pid = -1;
- close(sigio_private[0]);
- close(sigio_private[1]);
- close(write_sigio_fds[0]);
- close(write_sigio_fds[1]);
- /* Critical section end */
- set_signals(flags);
-}
-
-int add_sigio_fd(int fd, int read)
-{
- int err = 0, i, n, events;
-
- sigio_lock();
- for(i = 0; i < current_poll.used; i++){
- if(current_poll.poll[i].fd == fd)
- goto out;
- }
-
- n = current_poll.used + 1;
- err = need_poll(n);
- if(err)
- goto out;
-
- for(i = 0; i < current_poll.used; i++)
- next_poll.poll[i] = current_poll.poll[i];
-
- if(read) events = POLLIN;
- else events = POLLOUT;
-
- next_poll.poll[n - 1] = ((struct pollfd) { .fd = fd,
- .events = events,
- .revents = 0 });
- update_thread();
- out:
- sigio_unlock();
- return(err);
-}
-
-int ignore_sigio_fd(int fd)
-{
- struct pollfd *p;
- int err = 0, i, n = 0;
-
- sigio_lock();
- for(i = 0; i < current_poll.used; i++){
- if(current_poll.poll[i].fd == fd) break;
- }
- if(i == current_poll.used)
- goto out;
-
- err = need_poll(current_poll.used - 1);
- if(err)
- goto out;
-
- for(i = 0; i < current_poll.used; i++){
- p = ¤t_poll.poll[i];
- if(p->fd != fd) next_poll.poll[n++] = current_poll.poll[i];
- }
- if(n == i){
- printk("ignore_sigio_fd : fd %d not found\n", fd);
- err = -1;
- goto out;
- }
-
- update_thread();
- out:
- sigio_unlock();
- return(err);
-}
-
-static struct pollfd* setup_initial_poll(int fd)
-{
- struct pollfd *p;
-
- p = um_kmalloc(sizeof(struct pollfd));
- if (p == NULL) {
- printk("setup_initial_poll : failed to allocate poll\n");
- return NULL;
- }
- *p = ((struct pollfd) { .fd = fd,
- .events = POLLIN,
- .revents = 0 });
- return p;
-}
-
-void write_sigio_workaround(void)
-{
- unsigned long stack;
- struct pollfd *p;
- int err;
- int l_write_sigio_fds[2];
- int l_sigio_private[2];
- int l_write_sigio_pid;
-
- /* We call this *tons* of times - and most ones we must just fail. */
- sigio_lock();
- l_write_sigio_pid = write_sigio_pid;
- sigio_unlock();
-
- if (l_write_sigio_pid != -1)
- return;
-
- err = os_pipe(l_write_sigio_fds, 1, 1);
- if(err < 0){
- printk("write_sigio_workaround - os_pipe 1 failed, "
- "err = %d\n", -err);
- return;
- }
- err = os_pipe(l_sigio_private, 1, 1);
- if(err < 0){
- printk("write_sigio_workaround - os_pipe 1 failed, "
- "err = %d\n", -err);
- goto out_close1;
- }
-
- p = setup_initial_poll(l_sigio_private[1]);
- if(!p)
- goto out_close2;
-
- sigio_lock();
-
- /* Did we race? Don't try to optimize this, please, it's not so likely
- * to happen, and no more than once at the boot. */
- if(write_sigio_pid != -1)
- goto out_unlock;
-
- write_sigio_pid = run_helper_thread(write_sigio_thread, NULL,
- CLONE_FILES | CLONE_VM, &stack, 0);
-
- if (write_sigio_pid < 0)
- goto out_clear;
-
- if (write_sigio_irq(l_write_sigio_fds[0]))
- goto out_kill;
-
- /* Success, finally. */
- memcpy(write_sigio_fds, l_write_sigio_fds, sizeof(l_write_sigio_fds));
- memcpy(sigio_private, l_sigio_private, sizeof(l_sigio_private));
-
- current_poll = ((struct pollfds) { .poll = p,
- .used = 1,
- .size = 1 });
-
- sigio_unlock();
- return;
-
- out_kill:
- l_write_sigio_pid = write_sigio_pid;
- write_sigio_pid = -1;
- sigio_unlock();
- /* Going to call waitpid, avoid holding the lock. */
- os_kill_process(l_write_sigio_pid, 1);
- goto out_free;
-
- out_clear:
- write_sigio_pid = -1;
- out_unlock:
- sigio_unlock();
- out_free:
- kfree(p);
- out_close2:
- close(l_sigio_private[0]);
- close(l_sigio_private[1]);
- out_close1:
- close(l_write_sigio_fds[0]);
- close(l_write_sigio_fds[1]);
- return;
-}
-
-void sigio_cleanup(void)
-{
- if (write_sigio_pid != -1) {
- os_kill_process(write_sigio_pid, 1);
- write_sigio_pid = -1;
- }
-}
^ permalink raw reply
* [PATCH 6/16] UML - Move SIGIO startup code to os-Linux/start_up.c
From: Jeff Dike @ 2006-03-24 18:14 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, user-mode-linux-devel, Gennady Sharapov
The serial UML OS-abstraction layer patch (um/kernel dir).
This moves all startup code from sigio_user.c file under os-Linux dir
Signed-off-by: Gennady Sharapov <Gennady.V.Sharapov@intel.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Index: linux-2.6.16/arch/um/include/os.h
===================================================================
--- linux-2.6.16.orig/arch/um/include/os.h 2006-03-23 17:23:18.000000000 -0500
+++ linux-2.6.16/arch/um/include/os.h 2006-03-23 17:23:54.000000000 -0500
@@ -161,6 +161,7 @@ extern int os_lock_file(int fd, int excl
/* start_up.c */
extern void os_early_checks(void);
extern int can_do_skas(void);
+extern void os_check_bugs(void);
/* Make sure they are clear when running in TT mode. Required by
* SEGV_MAYBE_FIXABLE */
Index: linux-2.6.16/arch/um/include/sigio.h
===================================================================
--- linux-2.6.16.orig/arch/um/include/sigio.h 2006-03-23 17:23:18.000000000 -0500
+++ linux-2.6.16/arch/um/include/sigio.h 2006-03-23 17:23:54.000000000 -0500
@@ -8,7 +8,6 @@
extern int write_sigio_irq(int fd);
extern int register_sigio_fd(int fd);
-extern int read_sigio_fd(int fd);
extern int add_sigio_fd(int fd, int read);
extern int ignore_sigio_fd(int fd);
extern void sigio_lock(void);
Index: linux-2.6.16/arch/um/kernel/sigio_kern.c
===================================================================
--- linux-2.6.16.orig/arch/um/kernel/sigio_kern.c 2006-03-23 17:23:18.000000000 -0500
+++ linux-2.6.16/arch/um/kernel/sigio_kern.c 2006-03-23 17:23:54.000000000 -0500
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2002 - 2003 Jeff Dike (jdike@addtoit.com)
* Licensed under the GPL
*/
@@ -12,13 +12,16 @@
#include "sigio.h"
#include "irq_user.h"
#include "irq_kern.h"
+#include "os.h"
/* Protected by sigio_lock() called from write_sigio_workaround */
static int sigio_irq_fd = -1;
static irqreturn_t sigio_interrupt(int irq, void *data, struct pt_regs *unused)
{
- read_sigio_fd(sigio_irq_fd);
+ char c;
+
+ os_read_file(sigio_irq_fd, &c, sizeof(c));
reactivate_fd(sigio_irq_fd, SIGIO_WRITE_IRQ);
return(IRQ_HANDLED);
}
@@ -51,6 +54,9 @@ void sigio_unlock(void)
spin_unlock(&sigio_spinlock);
}
+extern void sigio_cleanup(void);
+__uml_exitcall(sigio_cleanup);
+
/*
* Overrides for Emacs so that we follow Linus's tabbing style.
* Emacs will notice this stuff at the end of the file and automatically
Index: linux-2.6.16/arch/um/kernel/sigio_user.c
===================================================================
--- linux-2.6.16.orig/arch/um/kernel/sigio_user.c 2006-03-23 17:23:18.000000000 -0500
+++ linux-2.6.16/arch/um/kernel/sigio_user.c 2006-03-23 17:25:36.000000000 -0500
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
* Licensed under the GPL
*/
@@ -20,127 +20,6 @@
#include "sigio.h"
#include "os.h"
-/* Changed during early boot */
-int pty_output_sigio = 0;
-int pty_close_sigio = 0;
-
-/* Used as a flag during SIGIO testing early in boot */
-static volatile int got_sigio = 0;
-
-void __init handler(int sig)
-{
- got_sigio = 1;
-}
-
-struct openpty_arg {
- int master;
- int slave;
- int err;
-};
-
-static void openpty_cb(void *arg)
-{
- struct openpty_arg *info = arg;
-
- info->err = 0;
- if(openpty(&info->master, &info->slave, NULL, NULL, NULL))
- info->err = -errno;
-}
-
-void __init check_one_sigio(void (*proc)(int, int))
-{
- struct sigaction old, new;
- struct openpty_arg pty = { .master = -1, .slave = -1 };
- int master, slave, err;
-
- initial_thread_cb(openpty_cb, &pty);
- if(pty.err){
- printk("openpty failed, errno = %d\n", -pty.err);
- return;
- }
-
- master = pty.master;
- slave = pty.slave;
-
- if((master == -1) || (slave == -1)){
- printk("openpty failed to allocate a pty\n");
- return;
- }
-
- /* Not now, but complain so we now where we failed. */
- err = raw(master);
- if (err < 0)
- panic("check_sigio : __raw failed, errno = %d\n", -err);
-
- err = os_sigio_async(master, slave);
- if(err < 0)
- panic("tty_fds : sigio_async failed, err = %d\n", -err);
-
- if(sigaction(SIGIO, NULL, &old) < 0)
- panic("check_sigio : sigaction 1 failed, errno = %d\n", errno);
- new = old;
- new.sa_handler = handler;
- if(sigaction(SIGIO, &new, NULL) < 0)
- panic("check_sigio : sigaction 2 failed, errno = %d\n", errno);
-
- got_sigio = 0;
- (*proc)(master, slave);
-
- os_close_file(master);
- os_close_file(slave);
-
- if(sigaction(SIGIO, &old, NULL) < 0)
- panic("check_sigio : sigaction 3 failed, errno = %d\n", errno);
-}
-
-static void tty_output(int master, int slave)
-{
- int n;
- char buf[512];
-
- printk("Checking that host ptys support output SIGIO...");
-
- memset(buf, 0, sizeof(buf));
-
- while(os_write_file(master, buf, sizeof(buf)) > 0) ;
- if(errno != EAGAIN)
- panic("check_sigio : write failed, errno = %d\n", errno);
- while(((n = os_read_file(slave, buf, sizeof(buf))) > 0) && !got_sigio) ;
-
- if (got_sigio) {
- printk("Yes\n");
- pty_output_sigio = 1;
- } else if (n == -EAGAIN) {
- printk("No, enabling workaround\n");
- } else {
- panic("check_sigio : read failed, err = %d\n", n);
- }
-}
-
-static void tty_close(int master, int slave)
-{
- printk("Checking that host ptys support SIGIO on close...");
-
- os_close_file(slave);
- if(got_sigio){
- printk("Yes\n");
- pty_close_sigio = 1;
- }
- else printk("No, enabling workaround\n");
-}
-
-void __init check_sigio(void)
-{
- if((os_access("/dev/ptmx", OS_ACC_R_OK) < 0) &&
- (os_access("/dev/ptyp0", OS_ACC_R_OK) < 0)){
- printk("No pseudo-terminals available - skipping pty SIGIO "
- "check\n");
- return;
- }
- check_one_sigio(tty_output);
- check_one_sigio(tty_close);
-}
-
/* Protected by sigio_lock(), also used by sigio_cleanup, which is an
* exitcall.
*/
@@ -267,10 +146,10 @@ static void update_thread(void)
if(write_sigio_pid != -1)
os_kill_process(write_sigio_pid, 1);
write_sigio_pid = -1;
- os_close_file(sigio_private[0]);
- os_close_file(sigio_private[1]);
- os_close_file(write_sigio_fds[0]);
- os_close_file(write_sigio_fds[1]);
+ close(sigio_private[0]);
+ close(sigio_private[1]);
+ close(write_sigio_fds[0]);
+ close(write_sigio_fds[1]);
/* Critical section end */
set_signals(flags);
}
@@ -428,39 +307,18 @@ void write_sigio_workaround(void)
out_free:
kfree(p);
out_close2:
- os_close_file(l_sigio_private[0]);
- os_close_file(l_sigio_private[1]);
+ close(l_sigio_private[0]);
+ close(l_sigio_private[1]);
out_close1:
- os_close_file(l_write_sigio_fds[0]);
- os_close_file(l_write_sigio_fds[1]);
+ close(l_write_sigio_fds[0]);
+ close(l_write_sigio_fds[1]);
return;
}
-int read_sigio_fd(int fd)
-{
- int n;
- char c;
-
- n = os_read_file(fd, &c, sizeof(c));
- if(n != sizeof(c)){
- if(n < 0) {
- printk("read_sigio_fd - read failed, err = %d\n", -n);
- return(n);
- }
- else {
- printk("read_sigio_fd - short read, bytes = %d\n", n);
- return(-EIO);
- }
- }
- return(n);
-}
-
-static void sigio_cleanup(void)
+void sigio_cleanup(void)
{
if (write_sigio_pid != -1) {
os_kill_process(write_sigio_pid, 1);
write_sigio_pid = -1;
}
}
-
-__uml_exitcall(sigio_cleanup);
Index: linux-2.6.16/arch/um/kernel/um_arch.c
===================================================================
--- linux-2.6.16.orig/arch/um/kernel/um_arch.c 2006-03-23 17:23:18.000000000 -0500
+++ linux-2.6.16/arch/um/kernel/um_arch.c 2006-03-23 17:23:54.000000000 -0500
@@ -487,8 +487,7 @@ void __init setup_arch(char **cmdline_p)
void __init check_bugs(void)
{
arch_check_bugs();
- check_sigio();
- check_devanon();
+ os_check_bugs();
}
void apply_alternatives(void *start, void *end)
Index: linux-2.6.16/arch/um/os-Linux/start_up.c
===================================================================
--- linux-2.6.16.orig/arch/um/os-Linux/start_up.c 2006-03-23 17:23:18.000000000 -0500
+++ linux-2.6.16/arch/um/os-Linux/start_up.c 2006-03-23 17:23:54.000000000 -0500
@@ -3,6 +3,7 @@
* Licensed under the GPL
*/
+#include <pty.h>
#include <stdio.h>
#include <stddef.h>
#include <stdarg.h>
@@ -539,3 +540,130 @@ int __init parse_iomem(char *str, int *a
return(1);
}
+
+/* Changed during early boot */
+int pty_output_sigio = 0;
+int pty_close_sigio = 0;
+
+/* Used as a flag during SIGIO testing early in boot */
+static volatile int got_sigio = 0;
+
+static void __init handler(int sig)
+{
+ got_sigio = 1;
+}
+
+struct openpty_arg {
+ int master;
+ int slave;
+ int err;
+};
+
+static void openpty_cb(void *arg)
+{
+ struct openpty_arg *info = arg;
+
+ info->err = 0;
+ if(openpty(&info->master, &info->slave, NULL, NULL, NULL))
+ info->err = -errno;
+}
+
+static void __init check_one_sigio(void (*proc)(int, int))
+{
+ struct sigaction old, new;
+ struct openpty_arg pty = { .master = -1, .slave = -1 };
+ int master, slave, err;
+
+ initial_thread_cb(openpty_cb, &pty);
+ if(pty.err){
+ printk("openpty failed, errno = %d\n", -pty.err);
+ return;
+ }
+
+ master = pty.master;
+ slave = pty.slave;
+
+ if((master == -1) || (slave == -1)){
+ printk("openpty failed to allocate a pty\n");
+ return;
+ }
+
+ /* Not now, but complain so we now where we failed. */
+ err = raw(master);
+ if (err < 0)
+ panic("check_sigio : __raw failed, errno = %d\n", -err);
+
+ err = os_sigio_async(master, slave);
+ if(err < 0)
+ panic("tty_fds : sigio_async failed, err = %d\n", -err);
+
+ if(sigaction(SIGIO, NULL, &old) < 0)
+ panic("check_sigio : sigaction 1 failed, errno = %d\n", errno);
+ new = old;
+ new.sa_handler = handler;
+ if(sigaction(SIGIO, &new, NULL) < 0)
+ panic("check_sigio : sigaction 2 failed, errno = %d\n", errno);
+
+ got_sigio = 0;
+ (*proc)(master, slave);
+
+ close(master);
+ close(slave);
+
+ if(sigaction(SIGIO, &old, NULL) < 0)
+ panic("check_sigio : sigaction 3 failed, errno = %d\n", errno);
+}
+
+static void tty_output(int master, int slave)
+{
+ int n;
+ char buf[512];
+
+ printk("Checking that host ptys support output SIGIO...");
+
+ memset(buf, 0, sizeof(buf));
+
+ while(os_write_file(master, buf, sizeof(buf)) > 0) ;
+ if(errno != EAGAIN)
+ panic("check_sigio : write failed, errno = %d\n", errno);
+ while(((n = os_read_file(slave, buf, sizeof(buf))) > 0) && !got_sigio) ;
+
+ if(got_sigio){
+ printk("Yes\n");
+ pty_output_sigio = 1;
+ }
+ else if(n == -EAGAIN) printk("No, enabling workaround\n");
+ else panic("check_sigio : read failed, err = %d\n", n);
+}
+
+static void tty_close(int master, int slave)
+{
+ printk("Checking that host ptys support SIGIO on close...");
+
+ close(slave);
+ if(got_sigio){
+ printk("Yes\n");
+ pty_close_sigio = 1;
+ }
+ else printk("No, enabling workaround\n");
+}
+
+void __init check_sigio(void)
+{
+ if((os_access("/dev/ptmx", OS_ACC_R_OK) < 0) &&
+ (os_access("/dev/ptyp0", OS_ACC_R_OK) < 0)){
+ printk("No pseudo-terminals available - skipping pty SIGIO "
+ "check\n");
+ return;
+ }
+ check_one_sigio(tty_output);
+ check_one_sigio(tty_close);
+}
+
+void os_check_bugs(void)
+{
+ check_ptrace();
+ check_sigio();
+ check_devanon();
+}
+
^ permalink raw reply
* [PATCH 3/16] UML - Fix some printf formats
From: Jeff Dike @ 2006-03-24 18:14 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, user-mode-linux-devel
Some printf formats are incorrect for large memory sizes.
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Index: linux-2.6.15-mm/arch/um/kernel/um_arch.c
===================================================================
--- linux-2.6.15-mm.orig/arch/um/kernel/um_arch.c 2006-02-21 17:40:12.000000000 -0500
+++ linux-2.6.15-mm/arch/um/kernel/um_arch.c 2006-02-21 17:59:39.000000000 -0500
@@ -421,7 +421,7 @@ int linux_main(int argc, char **argv)
#ifndef CONFIG_HIGHMEM
highmem = 0;
printf("CONFIG_HIGHMEM not enabled - physical memory shrunk "
- "to %lu bytes\n", physmem_size);
+ "to %Lu bytes\n", physmem_size);
#endif
}
@@ -433,8 +433,8 @@ int linux_main(int argc, char **argv)
setup_physmem(uml_physmem, uml_reserved, physmem_size, highmem);
if(init_maps(physmem_size, iomem_size, highmem)){
- printf("Failed to allocate mem_map for %lu bytes of physical "
- "memory and %lu bytes of highmem\n", physmem_size,
+ printf("Failed to allocate mem_map for %Lu bytes of physical "
+ "memory and %Lu bytes of highmem\n", physmem_size,
highmem);
exit(1);
}
^ permalink raw reply
* [PATCH 12/16] UML - Memory hotplug
From: Jeff Dike @ 2006-03-24 18:14 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, user-mode-linux-devel
This adds hotplug memory support to UML. The mconsole syntax is
config mem=[+-]n[KMG]
In other words, add or subtract some number of kilobytes, megabytes, or
gigabytes.
Unplugged pages are allocated and then madvise(MADV_REMOVE), which is
a currently experimental madvise extension. These pages are tracked so
they can be plugged back in later if the admin decides to give them back.
The first page to be unplugged is used to keep track of about 4M of other
pages. A list_head is the first thing on this page. The rest is filled
with addresses of other unplugged pages. This first page is not madvised,
obviously.
When this page is filled, the next page is used in a similar way and linked
onto a list with the first page. Etc.
This whole process reverses when pages are plugged back in. When a tracking
page no longer tracks any unplugged pages, then it is next in line for
plugging, which is done by freeing pages back to the kernel.
This patch also removes checking for /dev/anon on the host, which is obsoleted
by MADVISE_REMOVE.
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Index: linux-2.6.16/arch/um/drivers/mconsole_kern.c
===================================================================
--- linux-2.6.16.orig/arch/um/drivers/mconsole_kern.c 2006-03-23 17:15:05.000000000 -0500
+++ linux-2.6.16/arch/um/drivers/mconsole_kern.c 2006-03-23 17:39:21.000000000 -0500
@@ -20,6 +20,8 @@
#include "linux/namei.h"
#include "linux/proc_fs.h"
#include "linux/syscalls.h"
+#include "linux/list.h"
+#include "linux/mm.h"
#include "linux/console.h"
#include "asm/irq.h"
#include "asm/uaccess.h"
@@ -347,6 +349,139 @@ static struct mc_device *mconsole_find_d
return(NULL);
}
+#define UNPLUGGED_PER_PAGE \
+ ((PAGE_SIZE - sizeof(struct list_head)) / sizeof(unsigned long))
+
+struct unplugged_pages {
+ struct list_head list;
+ void *pages[UNPLUGGED_PER_PAGE];
+};
+
+static unsigned long long unplugged_pages_count = 0;
+static struct list_head unplugged_pages = LIST_HEAD_INIT(unplugged_pages);
+static int unplug_index = UNPLUGGED_PER_PAGE;
+
+static int mem_config(char *str)
+{
+ unsigned long long diff;
+ int err = -EINVAL, i, add;
+ char *ret;
+
+ if(str[0] != '=')
+ goto out;
+
+ str++;
+ if(str[0] == '-')
+ add = 0;
+ else if(str[0] == '+'){
+ add = 1;
+ }
+ else goto out;
+
+ str++;
+ diff = memparse(str, &ret);
+ if(*ret != '\0')
+ goto out;
+
+ diff /= PAGE_SIZE;
+
+ for(i = 0; i < diff; i++){
+ struct unplugged_pages *unplugged;
+ void *addr;
+
+ if(add){
+ if(list_empty(&unplugged_pages))
+ break;
+
+ unplugged = list_entry(unplugged_pages.next,
+ struct unplugged_pages, list);
+ if(unplug_index > 0)
+ addr = unplugged->pages[--unplug_index];
+ else {
+ list_del(&unplugged->list);
+ addr = unplugged;
+ unplug_index = UNPLUGGED_PER_PAGE;
+ }
+
+ free_page((unsigned long) addr);
+ unplugged_pages_count--;
+ }
+ else {
+ struct page *page;
+
+ page = alloc_page(GFP_ATOMIC);
+ if(page == NULL)
+ break;
+
+ unplugged = page_address(page);
+ if(unplug_index == UNPLUGGED_PER_PAGE){
+ INIT_LIST_HEAD(&unplugged->list);
+ list_add(&unplugged->list, &unplugged_pages);
+ unplug_index = 0;
+ }
+ else {
+ struct list_head *entry = unplugged_pages.next;
+ addr = unplugged;
+
+ unplugged = list_entry(entry,
+ struct unplugged_pages,
+ list);
+ unplugged->pages[unplug_index++] = addr;
+ err = os_drop_memory(addr, PAGE_SIZE);
+ if(err)
+ printk("Failed to release memory - "
+ "errno = %d\n", err);
+ }
+
+ unplugged_pages_count++;
+ }
+ }
+
+ err = 0;
+out:
+ return err;
+}
+
+static int mem_get_config(char *name, char *str, int size, char **error_out)
+{
+ char buf[sizeof("18446744073709551615\0")];
+ int len = 0;
+
+ sprintf(buf, "%ld", uml_physmem);
+ CONFIG_CHUNK(str, size, len, buf, 1);
+
+ return len;
+}
+
+static int mem_id(char **str, int *start_out, int *end_out)
+{
+ *start_out = 0;
+ *end_out = 0;
+
+ return 0;
+}
+
+static int mem_remove(int n)
+{
+ return -EBUSY;
+}
+
+static struct mc_device mem_mc = {
+ .name = "mem",
+ .config = mem_config,
+ .get_config = mem_get_config,
+ .id = mem_id,
+ .remove = mem_remove,
+};
+
+static int mem_mc_init(void)
+{
+ mconsole_register_dev(&mem_mc);
+ return 0;
+}
+
+__initcall(mem_mc_init);
+
#define CONFIG_BUF_SIZE 64
static void mconsole_get_config(int (*get_config)(char *, char *, int,
Index: linux-2.6.16/arch/um/include/os.h
===================================================================
--- linux-2.6.16.orig/arch/um/include/os.h 2006-03-23 17:35:56.000000000 -0500
+++ linux-2.6.16/arch/um/include/os.h 2006-03-23 17:39:21.000000000 -0500
@@ -205,6 +205,7 @@ extern int os_map_memory(void *virt, int
extern int os_protect_memory(void *addr, unsigned long len,
int r, int w, int x);
extern int os_unmap_memory(void *addr, int len);
+extern int os_drop_memory(void *addr, int length);
extern void os_flush_stdout(void);
/* tt.c
Index: linux-2.6.16/arch/um/os-Linux/process.c
===================================================================
--- linux-2.6.16.orig/arch/um/os-Linux/process.c 2006-03-23 17:15:05.000000000 -0500
+++ linux-2.6.16/arch/um/os-Linux/process.c 2006-03-23 17:39:21.000000000 -0500
@@ -187,6 +187,20 @@ int os_unmap_memory(void *addr, int len)
return(0);
}
+#ifndef MADV_REMOVE
+#define MADV_REMOVE 0x5 /* remove these pages & resources */
+#endif
+
+int os_drop_memory(void *addr, int length)
+{
+ int err;
+
+ err = madvise(addr, length, MADV_REMOVE);
+ if(err < 0)
+ err = -errno;
+ return 0;
+}
+
void init_new_thread_stack(void *sig_stack, void (*usr1_handler)(int))
{
int flags = 0, pages;
Index: linux-2.6.16/arch/um/include/mem_user.h
===================================================================
--- linux-2.6.16.orig/arch/um/include/mem_user.h 2006-03-23 17:15:05.000000000 -0500
+++ linux-2.6.16/arch/um/include/mem_user.h 2006-03-23 17:39:21.000000000 -0500
@@ -49,7 +49,6 @@ extern int iomem_size;
extern unsigned long host_task_size;
extern unsigned long task_size;
-extern void check_devanon(void);
extern int init_mem_user(void);
extern void setup_memory(void *entry);
extern unsigned long find_iomem(char *driver, unsigned long *len_out);
Index: linux-2.6.16/arch/um/os-Linux/mem.c
===================================================================
--- linux-2.6.16.orig/arch/um/os-Linux/mem.c 2006-03-23 17:15:05.000000000 -0500
+++ linux-2.6.16/arch/um/os-Linux/mem.c 2006-03-23 17:39:21.000000000 -0500
@@ -121,36 +121,11 @@ int create_tmp_file(unsigned long long l
return(fd);
}
-static int create_anon_file(unsigned long long len)
-{
- void *addr;
- int fd;
-
- fd = open("/dev/anon", O_RDWR);
- if(fd < 0) {
- perror("opening /dev/anon");
- exit(1);
- }
-
- addr = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
- if(addr == MAP_FAILED){
- perror("mapping physmem file");
- exit(1);
- }
- munmap(addr, len);
-
- return(fd);
-}
-
-extern int have_devanon;
-
int create_mem_file(unsigned long long len)
{
int err, fd;
- if(have_devanon)
- fd = create_anon_file(len);
- else fd = create_tmp_file(len);
+ fd = create_tmp_file(len);
err = os_set_exec_close(fd, 1);
if(err < 0){
Index: linux-2.6.16/arch/um/os-Linux/start_up.c
===================================================================
--- linux-2.6.16.orig/arch/um/os-Linux/start_up.c 2006-03-23 17:23:54.000000000 -0500
+++ linux-2.6.16/arch/um/os-Linux/start_up.c 2006-03-23 17:39:21.000000000 -0500
@@ -470,25 +470,6 @@ int can_do_skas(void)
}
#endif
-int have_devanon = 0;
-
-/* Runs on boot kernel stack - already safe to use printk. */
-
-void check_devanon(void)
-{
- int fd;
-
- printk("Checking for /dev/anon on the host...");
- fd = open("/dev/anon", O_RDWR);
- if(fd < 0){
- printk("Not available (open failed with errno %d)\n", errno);
- return;
- }
-
- printk("OK\n");
- have_devanon = 1;
-}
-
int __init parse_iomem(char *str, int *add)
{
struct iomem_region *new;
@@ -664,6 +645,5 @@ void os_check_bugs(void)
{
check_ptrace();
check_sigio();
- check_devanon();
}
^ permalink raw reply
* Re: Cloning from sites with 404 overridden
From: Morten Welinder @ 2006-03-24 18:16 UTC (permalink / raw)
To: Mark Wooding; +Cc: git
In-Reply-To: <slrne28b3a.cp6.mdw@metalzone.distorted.org.uk>
> (Aside: `C-u 38 0' doesn't work because Emacs hears `C-u 380' and waits
> for a key. `M-: (insert-char ?0 38) RET' does the right thing, but is
> ugly. Any better suggestions?)
There's a million ways to skin that cat.
ESC 38 C-q 60 RET
[Octal 060 == '0']
M.
^ permalink raw reply
* [PATCH] Use loff_t for size in struct proc_dir_entry
From: Maneesh Soni @ 2006-03-24 18:13 UTC (permalink / raw)
To: LKML, Vivek Goyal; +Cc: Andrew Morton
Hi,
Following patch is needed for seeing correct size for
/proc/vmcore for 32-bit systems with > 4G RAM.
Thanks
Maneesh
o Change proc_dir_entry->size to be loff_t to represent files
like /proc/vmcore for 32bit systems with more than 4G memory.
Signed-off-by: Maneesh Soni <maneesh@in.ibm.com>
---
linux-2.6.16-mm1-maneesh/include/linux/proc_fs.h | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
diff -puN include/linux/proc_fs.h~fix-proc_dir_entry-for-64bit-filesize include/linux/proc_fs.h
--- linux-2.6.16-mm1/include/linux/proc_fs.h~fix-proc_dir_entry-for-64bit-filesize 2006-03-24 23:22:43.630837640 +0530
+++ linux-2.6.16-mm1-maneesh/include/linux/proc_fs.h 2006-03-24 23:25:10.134565688 +0530
@@ -56,7 +56,7 @@ struct proc_dir_entry {
nlink_t nlink;
uid_t uid;
gid_t gid;
- unsigned long size;
+ loff_t size;
struct inode_operations * proc_iops;
const struct file_operations * proc_fops;
get_info_t *get_info;
_
^ permalink raw reply
* Re: [PATCH][5/8] proc: export mlocked pages info through "/proc/meminfo: Wired"
From: Nick Piggin @ 2006-03-24 16:38 UTC (permalink / raw)
To: Rik van Riel; +Cc: Stone Wang, akpm, linux-kernel, linux-mm
In-Reply-To: <Pine.LNX.4.63.0603241133550.30426@cuia.boston.redhat.com>
Rik van Riel wrote:
> On Wed, 22 Mar 2006, Nick Piggin wrote:
>
>
>>Why would you want to ever do something like that though? I don't think
>>you should use this name "just in case", unless you have some really
>>good potential usage in mind.
>
>
> ramfs
>
Why would ramfs want its pages in this wired list? (I'm not so
familiar with it but I can't think of a reason).
--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com
^ permalink raw reply
* [PATCH 9/16] UML - Move tty logging to os-Linux
From: Jeff Dike @ 2006-03-24 18:14 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, user-mode-linux-devel, Gennady Sharapov
The serial UML OS-abstraction layer patch (um/kernel dir).
This moves all systemcalls from tty_log.c file under os-Linux dir
Signed-off-by: Gennady Sharapov <Gennady.V.Sharapov@intel.com>
Index: linux-2.6.16/arch/um/kernel/exec_kern.c
===================================================================
--- linux-2.6.16.orig/arch/um/kernel/exec_kern.c 2006-03-23 17:15:05.000000000 -0500
+++ linux-2.6.16/arch/um/kernel/exec_kern.c 2006-03-23 17:31:59.000000000 -0500
@@ -30,8 +30,6 @@ void start_thread(struct pt_regs *regs,
CHOOSE_MODE_PROC(start_thread_tt, start_thread_skas, regs, eip, esp);
}
-extern void log_exec(char **argv, void *tty);
-
static long execve1(char *file, char __user * __user *argv,
char __user *__user *env)
{
Index: linux-2.6.16/arch/um/kernel/tty_log.c
===================================================================
--- linux-2.6.16.orig/arch/um/kernel/tty_log.c 2006-03-23 17:15:05.000000000 -0500
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,230 +0,0 @@
-/*
- * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) and
- * geoffrey hing <ghing@net.ohio-state.edu>
- * Licensed under the GPL
- */
-
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/time.h>
-#include "init.h"
-#include "user.h"
-#include "kern_util.h"
-#include "os.h"
-
-#define TTY_LOG_DIR "./"
-
-/* Set early in boot and then unchanged */
-static char *tty_log_dir = TTY_LOG_DIR;
-static int tty_log_fd = -1;
-
-#define TTY_LOG_OPEN 1
-#define TTY_LOG_CLOSE 2
-#define TTY_LOG_WRITE 3
-#define TTY_LOG_EXEC 4
-
-#define TTY_READ 1
-#define TTY_WRITE 2
-
-struct tty_log_buf {
- int what;
- unsigned long tty;
- int len;
- int direction;
- unsigned long sec;
- unsigned long usec;
-};
-
-int open_tty_log(void *tty, void *current_tty)
-{
- struct timeval tv;
- struct tty_log_buf data;
- char buf[strlen(tty_log_dir) + sizeof("01234567890-01234567\0")];
- int fd;
-
- gettimeofday(&tv, NULL);
- if(tty_log_fd != -1){
- data = ((struct tty_log_buf) { .what = TTY_LOG_OPEN,
- .tty = (unsigned long) tty,
- .len = sizeof(current_tty),
- .direction = 0,
- .sec = tv.tv_sec,
- .usec = tv.tv_usec } );
- os_write_file(tty_log_fd, &data, sizeof(data));
- os_write_file(tty_log_fd, ¤t_tty, data.len);
- return(tty_log_fd);
- }
-
- sprintf(buf, "%s/%0u-%0u", tty_log_dir, (unsigned int) tv.tv_sec,
- (unsigned int) tv.tv_usec);
-
- fd = os_open_file(buf, of_append(of_create(of_rdwr(OPENFLAGS()))),
- 0644);
- if(fd < 0){
- printk("open_tty_log : couldn't open '%s', errno = %d\n",
- buf, -fd);
- }
- return(fd);
-}
-
-void close_tty_log(int fd, void *tty)
-{
- struct tty_log_buf data;
- struct timeval tv;
-
- if(tty_log_fd != -1){
- gettimeofday(&tv, NULL);
- data = ((struct tty_log_buf) { .what = TTY_LOG_CLOSE,
- .tty = (unsigned long) tty,
- .len = 0,
- .direction = 0,
- .sec = tv.tv_sec,
- .usec = tv.tv_usec } );
- os_write_file(tty_log_fd, &data, sizeof(data));
- return;
- }
- os_close_file(fd);
-}
-
-static int log_chunk(int fd, const char *buf, int len)
-{
- int total = 0, try, missed, n;
- char chunk[64];
-
- while(len > 0){
- try = (len > sizeof(chunk)) ? sizeof(chunk) : len;
- missed = copy_from_user_proc(chunk, (char *) buf, try);
- try -= missed;
- n = os_write_file(fd, chunk, try);
- if(n != try) {
- if(n < 0)
- return(n);
- return(-EIO);
- }
- if(missed != 0)
- return(-EFAULT);
-
- len -= try;
- total += try;
- buf += try;
- }
-
- return(total);
-}
-
-int write_tty_log(int fd, const char *buf, int len, void *tty, int is_read)
-{
- struct timeval tv;
- struct tty_log_buf data;
- int direction;
-
- if(fd == tty_log_fd){
- gettimeofday(&tv, NULL);
- direction = is_read ? TTY_READ : TTY_WRITE;
- data = ((struct tty_log_buf) { .what = TTY_LOG_WRITE,
- .tty = (unsigned long) tty,
- .len = len,
- .direction = direction,
- .sec = tv.tv_sec,
- .usec = tv.tv_usec } );
- os_write_file(tty_log_fd, &data, sizeof(data));
- }
-
- return(log_chunk(fd, buf, len));
-}
-
-void log_exec(char **argv, void *tty)
-{
- struct timeval tv;
- struct tty_log_buf data;
- char **ptr,*arg;
- int len;
-
- if(tty_log_fd == -1) return;
-
- gettimeofday(&tv, NULL);
-
- len = 0;
- for(ptr = argv; ; ptr++){
- if(copy_from_user_proc(&arg, ptr, sizeof(arg)))
- return;
- if(arg == NULL) break;
- len += strlen_user_proc(arg);
- }
-
- data = ((struct tty_log_buf) { .what = TTY_LOG_EXEC,
- .tty = (unsigned long) tty,
- .len = len,
- .direction = 0,
- .sec = tv.tv_sec,
- .usec = tv.tv_usec } );
- os_write_file(tty_log_fd, &data, sizeof(data));
-
- for(ptr = argv; ; ptr++){
- if(copy_from_user_proc(&arg, ptr, sizeof(arg)))
- return;
- if(arg == NULL) break;
- log_chunk(tty_log_fd, arg, strlen_user_proc(arg));
- }
-}
-
-extern void register_tty_logger(int (*opener)(void *, void *),
- int (*writer)(int, const char *, int,
- void *, int),
- void (*closer)(int, void *));
-
-static int register_logger(void)
-{
- register_tty_logger(open_tty_log, write_tty_log, close_tty_log);
- return(0);
-}
-
-__uml_initcall(register_logger);
-
-static int __init set_tty_log_dir(char *name, int *add)
-{
- tty_log_dir = name;
- return 0;
-}
-
-__uml_setup("tty_log_dir=", set_tty_log_dir,
-"tty_log_dir=<directory>\n"
-" This is used to specify the directory where the logs of all pty\n"
-" data from this UML machine will be written.\n\n"
-);
-
-static int __init set_tty_log_fd(char *name, int *add)
-{
- char *end;
-
- tty_log_fd = strtoul(name, &end, 0);
- if((*end != '\0') || (end == name)){
- printf("set_tty_log_fd - strtoul failed on '%s'\n", name);
- tty_log_fd = -1;
- }
-
- *add = 0;
- return 0;
-}
-
-__uml_setup("tty_log_fd=", set_tty_log_fd,
-"tty_log_fd=<fd>\n"
-" This is used to specify a preconfigured file descriptor to which all\n"
-" tty data will be written. Preconfigure the descriptor with something\n"
-" like '10>tty_log tty_log_fd=10'.\n\n"
-);
-
-
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only. This must remain at the end
- * of the file.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-file-style: "linux"
- * End:
- */
Index: linux-2.6.16/arch/um/os-Linux/tty_log.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.16/arch/um/os-Linux/tty_log.c 2006-03-23 17:34:04.000000000 -0500
@@ -0,0 +1,218 @@
+/*
+ * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) and
+ * geoffrey hing <ghing@net.ohio-state.edu>
+ * Licensed under the GPL
+ */
+
+#include <errno.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/time.h>
+#include "init.h"
+#include "user.h"
+#include "kern_util.h"
+#include "os.h"
+
+#define TTY_LOG_DIR "./"
+
+/* Set early in boot and then unchanged */
+static char *tty_log_dir = TTY_LOG_DIR;
+static int tty_log_fd = -1;
+
+#define TTY_LOG_OPEN 1
+#define TTY_LOG_CLOSE 2
+#define TTY_LOG_WRITE 3
+#define TTY_LOG_EXEC 4
+
+#define TTY_READ 1
+#define TTY_WRITE 2
+
+struct tty_log_buf {
+ int what;
+ unsigned long tty;
+ int len;
+ int direction;
+ unsigned long sec;
+ unsigned long usec;
+};
+
+int open_tty_log(void *tty, void *current_tty)
+{
+ struct timeval tv;
+ struct tty_log_buf data;
+ char buf[strlen(tty_log_dir) + sizeof("01234567890-01234567\0")];
+ int fd;
+
+ gettimeofday(&tv, NULL);
+ if(tty_log_fd != -1){
+ data = ((struct tty_log_buf) { .what = TTY_LOG_OPEN,
+ .tty = (unsigned long) tty,
+ .len = sizeof(current_tty),
+ .direction = 0,
+ .sec = tv.tv_sec,
+ .usec = tv.tv_usec } );
+ os_write_file(tty_log_fd, &data, sizeof(data));
+ os_write_file(tty_log_fd, ¤t_tty, data.len);
+ return(tty_log_fd);
+ }
+
+ sprintf(buf, "%s/%0u-%0u", tty_log_dir, (unsigned int) tv.tv_sec,
+ (unsigned int) tv.tv_usec);
+
+ fd = os_open_file(buf, of_append(of_create(of_rdwr(OPENFLAGS()))),
+ 0644);
+ if(fd < 0){
+ printk("open_tty_log : couldn't open '%s', errno = %d\n",
+ buf, -fd);
+ }
+ return(fd);
+}
+
+void close_tty_log(int fd, void *tty)
+{
+ struct tty_log_buf data;
+ struct timeval tv;
+
+ if(tty_log_fd != -1){
+ gettimeofday(&tv, NULL);
+ data = ((struct tty_log_buf) { .what = TTY_LOG_CLOSE,
+ .tty = (unsigned long) tty,
+ .len = 0,
+ .direction = 0,
+ .sec = tv.tv_sec,
+ .usec = tv.tv_usec } );
+ os_write_file(tty_log_fd, &data, sizeof(data));
+ return;
+ }
+ os_close_file(fd);
+}
+
+static int log_chunk(int fd, const char *buf, int len)
+{
+ int total = 0, try, missed, n;
+ char chunk[64];
+
+ while(len > 0){
+ try = (len > sizeof(chunk)) ? sizeof(chunk) : len;
+ missed = copy_from_user_proc(chunk, (char *) buf, try);
+ try -= missed;
+ n = os_write_file(fd, chunk, try);
+ if(n != try) {
+ if(n < 0)
+ return(n);
+ return(-EIO);
+ }
+ if(missed != 0)
+ return(-EFAULT);
+
+ len -= try;
+ total += try;
+ buf += try;
+ }
+
+ return(total);
+}
+
+int write_tty_log(int fd, const char *buf, int len, void *tty, int is_read)
+{
+ struct timeval tv;
+ struct tty_log_buf data;
+ int direction;
+
+ if(fd == tty_log_fd){
+ gettimeofday(&tv, NULL);
+ direction = is_read ? TTY_READ : TTY_WRITE;
+ data = ((struct tty_log_buf) { .what = TTY_LOG_WRITE,
+ .tty = (unsigned long) tty,
+ .len = len,
+ .direction = direction,
+ .sec = tv.tv_sec,
+ .usec = tv.tv_usec } );
+ os_write_file(tty_log_fd, &data, sizeof(data));
+ }
+
+ return(log_chunk(fd, buf, len));
+}
+
+void log_exec(char **argv, void *tty)
+{
+ struct timeval tv;
+ struct tty_log_buf data;
+ char **ptr,*arg;
+ int len;
+
+ if(tty_log_fd == -1) return;
+
+ gettimeofday(&tv, NULL);
+
+ len = 0;
+ for(ptr = argv; ; ptr++){
+ if(copy_from_user_proc(&arg, ptr, sizeof(arg)))
+ return;
+ if(arg == NULL) break;
+ len += strlen_user_proc(arg);
+ }
+
+ data = ((struct tty_log_buf) { .what = TTY_LOG_EXEC,
+ .tty = (unsigned long) tty,
+ .len = len,
+ .direction = 0,
+ .sec = tv.tv_sec,
+ .usec = tv.tv_usec } );
+ os_write_file(tty_log_fd, &data, sizeof(data));
+
+ for(ptr = argv; ; ptr++){
+ if(copy_from_user_proc(&arg, ptr, sizeof(arg)))
+ return;
+ if(arg == NULL) break;
+ log_chunk(tty_log_fd, arg, strlen_user_proc(arg));
+ }
+}
+
+extern void register_tty_logger(int (*opener)(void *, void *),
+ int (*writer)(int, const char *, int,
+ void *, int),
+ void (*closer)(int, void *));
+
+static int register_logger(void)
+{
+ register_tty_logger(open_tty_log, write_tty_log, close_tty_log);
+ return(0);
+}
+
+__uml_initcall(register_logger);
+
+static int __init set_tty_log_dir(char *name, int *add)
+{
+ tty_log_dir = name;
+ return 0;
+}
+
+__uml_setup("tty_log_dir=", set_tty_log_dir,
+"tty_log_dir=<directory>\n"
+" This is used to specify the directory where the logs of all pty\n"
+" data from this UML machine will be written.\n\n"
+);
+
+static int __init set_tty_log_fd(char *name, int *add)
+{
+ char *end;
+
+ tty_log_fd = strtoul(name, &end, 0);
+ if((*end != '\0') || (end == name)){
+ printf("set_tty_log_fd - strtoul failed on '%s'\n", name);
+ tty_log_fd = -1;
+ }
+
+ *add = 0;
+ return 0;
+}
+
+__uml_setup("tty_log_fd=", set_tty_log_fd,
+"tty_log_fd=<fd>\n"
+" This is used to specify a preconfigured file descriptor to which all\n"
+" tty data will be written. Preconfigure the descriptor with something\n"
+" like '10>tty_log tty_log_fd=10'.\n\n"
+);
Index: linux-2.6.16/arch/um/kernel/Makefile
===================================================================
--- linux-2.6.16.orig/arch/um/kernel/Makefile 2006-03-23 17:26:25.000000000 -0500
+++ linux-2.6.16/arch/um/kernel/Makefile 2006-03-23 17:31:59.000000000 -0500
@@ -15,15 +15,12 @@ obj-y = config.o exec_kern.o exitcode.o
obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o
obj-$(CONFIG_GPROF) += gprof_syms.o
obj-$(CONFIG_GCOV) += gmon_syms.o
-obj-$(CONFIG_TTY_LOG) += tty_log.o
obj-$(CONFIG_SYSCALL_DEBUG) += syscall.o
obj-$(CONFIG_MODE_TT) += tt/
obj-$(CONFIG_MODE_SKAS) += skas/
-user-objs-$(CONFIG_TTY_LOG) += tty_log.o
-
-USER_OBJS := $(user-objs-y) config.o tty_log.o
+USER_OBJS := config.o
include arch/um/scripts/Makefile.rules
Index: linux-2.6.16/arch/um/os-Linux/Makefile
===================================================================
--- linux-2.6.16.orig/arch/um/os-Linux/Makefile 2006-03-23 17:26:25.000000000 -0500
+++ linux-2.6.16/arch/um/os-Linux/Makefile 2006-03-23 17:31:59.000000000 -0500
@@ -8,10 +8,12 @@ obj-y = aio.o elf_aux.o file.o helper.o
user_syms.o util.o drivers/ sys-$(SUBARCH)/
obj-$(CONFIG_MODE_SKAS) += skas/
+obj-$(CONFIG_TTY_LOG) += tty_log.o
+user-objs-$(CONFIG_TTY_LOG) += tty_log.o
-USER_OBJS := aio.o elf_aux.o file.o helper.o irq.o main.o mem.o process.o \
- sigio.o signal.o start_up.o time.o trap.o tt.o tty.o uaccess.o umid.o \
- util.o
+USER_OBJS := $(user-objs-y) aio.o elf_aux.o file.o helper.o irq.o main.o mem.o \
+ process.o sigio.o signal.o start_up.o time.o trap.o tt.o tty.o \
+ uaccess.o umid.o util.o
elf_aux.o: $(ARCH_DIR)/kernel-offsets.h
CFLAGS_elf_aux.o += -I$(objtree)/arch/um
^ permalink raw reply
* [PATCH 11/16] UML - Allow ubd devices to be shared in a cluster
From: Jeff Dike @ 2006-03-24 18:14 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, user-mode-linux-devel
This adds a 'c' option to the ubd switch which turns off host file locking
so that the device can be shared, as with a cluster.
There's also some whitespace cleanup while I was in this file.
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Index: linux-2.6.16/arch/um/drivers/ubd_kern.c
===================================================================
--- linux-2.6.16.orig/arch/um/drivers/ubd_kern.c 2006-03-23 17:15:05.000000000 -0500
+++ linux-2.6.16/arch/um/drivers/ubd_kern.c 2006-03-23 17:37:47.000000000 -0500
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
* Licensed under the GPL
*/
@@ -71,7 +71,7 @@ struct io_thread_req {
int error;
};
-extern int open_ubd_file(char *file, struct openflags *openflags,
+extern int open_ubd_file(char *file, struct openflags *openflags, int shared,
char **backing_file_out, int *bitmap_offset_out,
unsigned long *bitmap_len_out, int *data_offset_out,
int *create_cow_out);
@@ -137,7 +137,7 @@ static int fake_major = MAJOR_NR;
static struct gendisk *ubd_gendisk[MAX_DEV];
static struct gendisk *fake_gendisk[MAX_DEV];
-
+
#ifdef CONFIG_BLK_DEV_UBD_SYNC
#define OPEN_FLAGS ((struct openflags) { .r = 1, .w = 1, .s = 1, .c = 0, \
.cl = 1 })
@@ -168,6 +168,7 @@ struct ubd {
__u64 size;
struct openflags boot_openflags;
struct openflags openflags;
+ int shared;
int no_cow;
struct cow cow;
struct platform_device pdev;
@@ -189,6 +190,7 @@ struct ubd {
.boot_openflags = OPEN_FLAGS, \
.openflags = OPEN_FLAGS, \
.no_cow = 0, \
+ .shared = 0, \
.cow = DEFAULT_COW, \
}
@@ -305,7 +307,7 @@ static int ubd_setup_common(char *str, i
}
major = simple_strtoul(str, &end, 0);
if((*end != '\0') || (end == str)){
- printk(KERN_ERR
+ printk(KERN_ERR
"ubd_setup : didn't parse major number\n");
return(1);
}
@@ -316,7 +318,7 @@ static int ubd_setup_common(char *str, i
printk(KERN_ERR "Can't assign a fake major twice\n");
goto out1;
}
-
+
fake_major = major;
printk(KERN_INFO "Setting extra ubd major number to %d\n",
@@ -351,7 +353,7 @@ static int ubd_setup_common(char *str, i
if (index_out)
*index_out = n;
- for (i = 0; i < 4; i++) {
+ for (i = 0; i < sizeof("rscd="); i++) {
switch (*str) {
case 'r':
flags.w = 0;
@@ -362,11 +364,14 @@ static int ubd_setup_common(char *str, i
case 'd':
dev->no_cow = 1;
break;
+ case 'c':
+ dev->shared = 1;
+ break;
case '=':
str++;
goto break_loop;
default:
- printk(KERN_ERR "ubd_setup : Expected '=' or flag letter (r,s or d)\n");
+ printk(KERN_ERR "ubd_setup : Expected '=' or flag letter (r, s, c, or d)\n");
goto out;
}
str++;
@@ -515,7 +520,7 @@ static void ubd_handler(void)
spin_unlock(&ubd_io_lock);
return;
}
-
+
ubd_finish(rq, req.error);
reactivate_fd(thread_fd, UBD_IRQ);
do_ubd_request(ubd_queue);
@@ -532,7 +537,7 @@ static int io_pid = -1;
void kill_io_thread(void)
{
- if(io_pid != -1)
+ if(io_pid != -1)
os_kill_process(io_pid, 1);
}
@@ -567,14 +572,15 @@ static int ubd_open_dev(struct ubd *dev)
create_cow = 0;
create_ptr = (dev->cow.file != NULL) ? &create_cow : NULL;
back_ptr = dev->no_cow ? NULL : &dev->cow.file;
- dev->fd = open_ubd_file(dev->file, &dev->openflags, back_ptr,
- &dev->cow.bitmap_offset, &dev->cow.bitmap_len,
- &dev->cow.data_offset, create_ptr);
+ dev->fd = open_ubd_file(dev->file, &dev->openflags, dev->shared,
+ back_ptr, &dev->cow.bitmap_offset,
+ &dev->cow.bitmap_len, &dev->cow.data_offset,
+ create_ptr);
if((dev->fd == -ENOENT) && create_cow){
- dev->fd = create_cow_file(dev->file, dev->cow.file,
+ dev->fd = create_cow_file(dev->file, dev->cow.file,
dev->openflags, 1 << 9, PAGE_SIZE,
- &dev->cow.bitmap_offset,
+ &dev->cow.bitmap_offset,
&dev->cow.bitmap_len,
&dev->cow.data_offset);
if(dev->fd >= 0){
@@ -598,16 +604,16 @@ static int ubd_open_dev(struct ubd *dev)
}
flush_tlb_kernel_vm();
- err = read_cow_bitmap(dev->fd, dev->cow.bitmap,
- dev->cow.bitmap_offset,
+ err = read_cow_bitmap(dev->fd, dev->cow.bitmap,
+ dev->cow.bitmap_offset,
dev->cow.bitmap_len);
if(err < 0)
goto error;
flags = dev->openflags;
flags.w = 0;
- err = open_ubd_file(dev->cow.file, &flags, NULL, NULL, NULL,
- NULL, NULL);
+ err = open_ubd_file(dev->cow.file, &flags, dev->shared, NULL,
+ NULL, NULL, NULL, NULL);
if(err < 0) goto error;
dev->cow.fd = err;
}
@@ -685,11 +691,11 @@ static int ubd_add(int n)
dev->size = ROUND_BLOCK(dev->size);
err = ubd_new_disk(MAJOR_NR, dev->size, n, &ubd_gendisk[n]);
- if(err)
+ if(err)
goto out_close;
-
+
if(fake_major != MAJOR_NR)
- ubd_new_disk(fake_major, dev->size, n,
+ ubd_new_disk(fake_major, dev->size, n,
&fake_gendisk[n]);
/* perhaps this should also be under the "if (fake_major)" above */
@@ -854,7 +860,7 @@ int ubd_init(void)
return -1;
}
platform_driver_register(&ubd_driver);
- for (i = 0; i < MAX_DEV; i++)
+ for (i = 0; i < MAX_DEV; i++)
ubd_add(i);
return 0;
}
@@ -872,16 +878,16 @@ int ubd_driver_init(void){
* enough. So use anyway the io thread. */
}
stack = alloc_stack(0, 0);
- io_pid = start_io_thread(stack + PAGE_SIZE - sizeof(void *),
+ io_pid = start_io_thread(stack + PAGE_SIZE - sizeof(void *),
&thread_fd);
if(io_pid < 0){
- printk(KERN_ERR
+ printk(KERN_ERR
"ubd : Failed to start I/O thread (errno = %d) - "
"falling back to synchronous I/O\n", -io_pid);
io_pid = -1;
return(0);
}
- err = um_request_irq(UBD_IRQ, thread_fd, IRQ_READ, ubd_intr,
+ err = um_request_irq(UBD_IRQ, thread_fd, IRQ_READ, ubd_intr,
SA_INTERRUPT, "ubd", ubd_dev);
if(err != 0)
printk(KERN_ERR "um_request_irq failed - errno = %d\n", -err);
@@ -978,7 +984,7 @@ static void cowify_req(struct io_thread_
if(req->op == UBD_READ) {
for(i = 0; i < req->length >> 9; i++){
if(ubd_test_bit(sector + i, (unsigned char *) bitmap))
- ubd_set_bit(i, (unsigned char *)
+ ubd_set_bit(i, (unsigned char *)
&req->sector_mask);
}
}
@@ -999,7 +1005,7 @@ static int prepare_request(struct reques
/* This should be impossible now */
if((rq_data_dir(req) == WRITE) && !dev->openflags.w){
- printk("Write attempted on readonly ubd device %s\n",
+ printk("Write attempted on readonly ubd device %s\n",
disk->disk_name);
end_request(req, 0);
return(1);
@@ -1182,7 +1188,7 @@ int read_cow_bitmap(int fd, void *buf, i
return(0);
}
-int open_ubd_file(char *file, struct openflags *openflags,
+int open_ubd_file(char *file, struct openflags *openflags, int shared,
char **backing_file_out, int *bitmap_offset_out,
unsigned long *bitmap_len_out, int *data_offset_out,
int *create_cow_out)
@@ -1206,10 +1212,14 @@ int open_ubd_file(char *file, struct ope
return fd;
}
- err = os_lock_file(fd, openflags->w);
- if(err < 0){
- printk("Failed to lock '%s', err = %d\n", file, -err);
- goto out_close;
+ if(shared)
+ printk("Not locking \"%s\" on the host\n", file);
+ else {
+ err = os_lock_file(fd, openflags->w);
+ if(err < 0){
+ printk("Failed to lock '%s', err = %d\n", file, -err);
+ goto out_close;
+ }
}
/* Succesful return case! */
@@ -1260,7 +1270,7 @@ int create_cow_file(char *cow_file, char
int err, fd;
flags.c = 1;
- fd = open_ubd_file(cow_file, &flags, NULL, NULL, NULL, NULL, NULL);
+ fd = open_ubd_file(cow_file, &flags, 0, NULL, NULL, NULL, NULL, NULL);
if(fd < 0){
err = fd;
printk("Open of COW file '%s' failed, errno = %d\n", cow_file,
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.