aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/lib (follow)
AgeCommit message (Collapse)AuthorFilesLines
2009-10-06[S390] Add EX_TABLE for addressing exception in usercopy functions.Gerald Schaefer2-12/+14
This patch adds an EX_TABLE entry to mvc{p|s|os} usercopy functions that may be called with KERNEL_DS. In combination with collaborative memory management, kernel pages marked as unused may trigger an adressing exception in the usercopy functions. This fixes an unhandled addressing exception bug where strncpy_from_user() is used with len > strnlen and KERNEL_DS, crossing a page boundary to an unused page. Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-10-06[S390] Provide arch specific mdelay implementation.Heiko Carstens1-7/+7
Use an own implementation instead of the common code udelay loop. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-10-06[S390] Fix enabled udelay for short delays.Christian Borntraeger1-4/+9
When udelay() gets called with a delay that would expire before the next clock event it reprograms the clock comparator. When the interrupt happens the clock comparator won't be resetted therefore the interrupt condition doesn't get cleared. The result is an endless timer interrupt loop until the next clock event would expire (stored in lowcore). So udelay() usually would wait much longer for small delays than it should. Fix this by disabling the local tick which makes sure that the clock comparator will be resetted when a timer interrupt happens. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-07-07[S390] add __ucmpdi2() helper functionHeiko Carstens2-1/+27
Provide __ucmpdi2() helper function on 31 bit so we don't run again and again in compile errors like this one: kernel/built-in.o: In function `T.689': perf_counter.c:(.text+0x56c86): undefined reference to `__ucmpdi2' Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-07-07[S390] udelay: disable lockdep to avoid false positivesHeiko Carstens1-0/+2
Our udelay implementation enables interrupts to receive a special timer interrupt regardless of the context it is called from. This might lead to false positive lockdep reports. Since lockdep isn't aware of the fact that only a single interrupt source is enabled it warns about possible deadlocks that in reality won't happen, like the one below. To fix this disable lockdep before enabling interrupts. [ 254.040888] ================================= [ 254.040904] [ INFO: inconsistent lock state ] [ 254.040910] 2.6.30 #9 [ 254.040914] --------------------------------- [ 254.040920] inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage. [ 254.040927] swapper/0 [HC0[0]:SC1[1]:HE1:SE0] takes: [ 254.040934] (sch->lock){?.-...}, at: [<00000000002e4778>] ccw_device_timeout+0x48/0x2f0 [ 254.040961] {IN-HARDIRQ-W} state was registered at: [ 254.040969] [<0000000000096f74>] __lock_acquire+0x9d4/0x188c [ 254.040985] [<0000000000097f68>] lock_acquire+0x13c/0x16c [ 254.040998] [<00000000004527e0>] _spin_lock+0x74/0xb8 [ 254.041016] [<0000000000457eb2>] do_IRQ+0xde/0x208 [ 254.041031] [<000000000002d190>] io_return+0x0/0x8 [ 254.041049] [<0000000000029faa>] vtime_stop_cpu+0xbe/0x114 [ 254.041066] irq event stamp: 259629 [ 254.041076] hardirqs last enabled at (259628): [<000000000045238e>] _spin_unlock_irq+0x5e/0x9c [ 254.041095] hardirqs last disabled at (259629): [<000000000045292e>] _spin_lock_irq+0x4a/0xc4 [ 254.041126] softirqs last enabled at (259614): [<000000000006500e>] __do_softirq+0x296/0x2b0 [ 254.041137] softirqs last disabled at (259619): [<0000000000024cf6>] do_softirq+0x102/0x108 [ 254.041147] [ 254.041148] other info that might help us debug this: [ 254.041153] 2 locks held by swapper/0: [ 254.041157] #0: (&priv->timer){+.-...}, at: [<000000000006bf9a>] run_timer_softirq+0x19a/0x340 [ 254.041170] #1: (sch->lock){?.-...}, at: [<00000000002e4778>] ccw_device_timeout+0x48/0x2f0 [ 254.041182] [ 254.041310] Call Trace: [ 254.041313] ([<00000000000174fc>] show_trace+0x16c/0x170) [ 254.041321] [<0000000000017578>] show_stack+0x78/0x104 [ 254.041327] [<000000000044d0ca>] dump_stack+0xc6/0xd4 [ 254.041342] [<00000000000949b4>] print_usage_bug+0x1c8/0x1fc [ 254.041353] [<0000000000094e8a>] mark_lock+0x4a2/0x670 [ 254.041364] [<00000000000950e2>] mark_held_locks+0x8a/0xb4 [ 254.041375] [<0000000000095398>] trace_hardirqs_on_caller+0x74/0x1ac [ 254.041388] [<00000000000954fa>] trace_hardirqs_on+0x2a/0x38 [ 254.041402] [<000000000025f1ec>] __udelay_disabled+0xac/0xfc [ 254.041419] [<000000000025f432>] __udelay+0x12a/0x148 [ 254.041433] [<00000000002d64d8>] cio_commit_config+0x170/0x290 [ 254.041451] [<00000000002d6978>] cio_disable_subchannel+0x120/0x1cc [ 254.041468] [<00000000002e32a4>] ccw_device_recog_done+0x54/0x2f4 [ 254.041485] [<00000000002e3638>] ccw_device_sense_id_done+0x50/0x90 [ 254.041508] [<00000000002e615a>] snsid_callback+0xfa/0x3a8 [ 254.041515] [<00000000002dd96c>] ccwreq_stop+0x80/0x90 [ 254.041523] [<00000000002dda8e>] ccw_request_timeout+0xc2/0xd0 [ 254.041530] [<00000000002e2f70>] ccw_device_request_event+0x58/0x90 [ 254.041537] [<00000000002e47ae>] ccw_device_timeout+0x7e/0x2f0 [ 254.041555] [<000000000006c02a>] run_timer_softirq+0x22a/0x340 [ 254.041566] [<0000000000064eb0>] __do_softirq+0x138/0x2b0 [ 254.041578] [<0000000000024cf6>] do_softirq+0x102/0x108 [ 254.041590] [<00000000000647ce>] irq_exit+0xee/0x114 [ 254.041603] [<0000000000457d88>] do_extint+0x130/0x17c [ 254.041617] [<000000000002d41e>] ext_no_vtime+0x1e/0x22 [ 254.041631] [<0000000000029faa>] vtime_stop_cpu+0xbe/0x114 [ 254.041646] ([<0000000000029f58>] vtime_stop_cpu+0x6c/0x114) [ 254.041662] [<000000000001d842>] cpu_idle+0x122/0x1c0 [ 254.041679] [<00000000004482c6>] start_secondary+0xce/0xe0 [ 254.041696] [<0000000000000000>] 0x0 [ 254.041715] [<0000000000000000>] 0x0 [ 254.041745] INFO: lockdep is turned off. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-06-21Move FAULT_FLAG_xyz into handle_mm_fault() callersLinus Torvalds1-1/+1
This allows the callers to now pass down the full set of FAULT_FLAG_xyz flags to handle_mm_fault(). All callers have been (mechanically) converted to the new calling convention, there's almost certainly room for architectures to clean up their code and then add FAULT_FLAG_RETRY when that support is added. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-06-12[S390] implement interrupt-enabling rwlocksHeiko Carstens1-0/+40
arch backend for f5f7eac41db827a47b2163330eecd7bb55ae9f12 "Allow rwlocks to re-enable interrupts". Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26[S390] use compiler builtin versions of strlen/strcpy/strcatHeiko Carstens1-0/+8
Use builtin variants if gcc 4 or newer is used to compile the kernel. Generates better code than the asm variants. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26[S390] move EXPORT_SYMBOLs to definitionsHeiko Carstens1-0/+2
Move all EXPORT_SYMBOLs to their corresponding definitions. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-18[S390] Dont check for pfn_valid() in uaccess_pt.cGerald Schaefer1-18/+0
pfn_valid() actually checks for a valid struct page and not for a valid pfn. Using xip mappings w/o struct pages, this will result in -EFAULT returned by the (page table walk) user copy functions, even though there is valid memory. Those user copy functions don't need a struct page, so this patch just removes the pfn_valid() check. Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-18[S390] __div64_31 broken for CONFIG_MARCH_G5Martin Schwidefsky1-1/+1
The implementation of __div64_31 for G5 machines is broken. The comments in __div64_31 are correct, only the code does not do what the comments say. The part "If the remainder has overflown subtract base and increase the quotient" is only partially realized, the base is subtracted correctly but the quotient is only increased if the dividend had the last bit set. Using the correct instruction fixes the problem. Cc: stable@kernel.org Reported-by: Frans Pop <elendil@planet.nl> Tested-by: Frans Pop <elendil@planet.nl> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-10-10[S390] Move private simple udelay function to arch/s390/lib/delay.c.Heiko Carstens1-0/+13
Move cio's private simple udelay function to lib/delay.c and turn it into something much more readable. So we have all implementations at one place. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-10-03[S390] nohz: Fix __udelay.Heiko Carstens1-34/+54
This fixes a regression that came with 934b2857cc576ae53c92a66e63fce7ddcfa74691 ("[S390] nohz/sclp: disable timer on synchronous waits."). If udelay() gets called from a disabled context it sets the clock comparator to a value where it expects the next interrupt. When the interrupt happens the clock comparator gets not reset and therefore the interrupt condition doesn't get cleared. The result is an endless timer interrupt loop. In addition this patch fixes also the following: rcutorture reveals that our __udelay implementation is still buggy, since it might schedule tasklets, but prevents their execution: NOHZ: local_softirq_pending 42 NOHZ: local_softirq_pending 02 NOHZ: local_softirq_pending 142 NOHZ: local_softirq_pending 02 To fix this we make sure that only the clock comparator interrupt is enabled when the enabled wait psw is loaded. Also no code gets called anymore which might schedule tasklets. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-08-01[S390] nohz/sclp: disable timer on synchronous waits.Heiko Carstens1-2/+2
sclp_sync_wait wait synchronously for an sclp interrupt and disables timer interrupts. However on the irq enter paths there is an extra check if a timer interrupt would be due and calls the timer callback. This would schedule softirqs in the wrong context. So introduce local_tick_enable/disable which prevents this. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-04-30[S390] uaccess_mvcos: #ifdef config dependent code.Heiko Carstens1-0/+2
arch/s390/lib/uaccess_mvcos.c:166: warning: 'strnlen_user_mvcos' defined but not used arch/s390/lib/uaccess_mvcos.c:186: warning: 'strncpy_from_user_mvcos' defined but not used Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-04-30[S390] remove -traditionalMathieu Desnoyers1-2/+0
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> CC: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-04-17[S390] uaccess: Always access the correct address space.Heiko Carstens1-18/+41
The current uaccess page table walk code assumes at a few places that any access is a user space access. This is not correct if somebody has issued a set_fs(KERNEL_DS) in advance. Add code which checks which address space we are in and with this make sure we access the correct address space. This way we get also rid of the dirty if (!currrent-mm) return -EFAULT; hack in futex_atomic_cmpxchg_pt. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2008-04-17[S390] Convert s390 to GENERIC_CLOCKEVENTS.Heiko Carstens1-7/+7
This way we get rid of s390's NO_IDLE_HZ and use the generic dynticks variant instead. In addition we get high resolution timers for free. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2008-03-20[S390] futex: let futex_atomic_cmpxchg_pt survive early functional tests.Heiko Carstens1-0/+2
a0c1e9073ef7428a14309cba010633a6cd6719ea "futex: runtime enable pi and robust functionality" introduces a test wether futex in atomic stuff works or not. It does that by writing to address 0 of the kernel address space. This will crash on older machines where addressing mode switching is enabled but where the mvcos instruction is not available. Page table walking is done by hand and therefore the code tries to access current->mm which is NULL. Therefore add an extra check, so we survive the early test. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-02-19[S390] Fix futex_atomic_cmpxchg_std inline assembly.Heiko Carstens1-4/+4
Add missing exception table entry so that the kernel can handle proctection exceptions as well on the cs instruction. Currently only specification exceptions are handled correctly. The missing entry allows user space to crash the kernel. Cc: stable <stable@kernel.org> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-01-26[S390] do local_irq_restore while spinning in spin_lock_irqsave.Hisashi Hifumi1-0/+23
In s390's spin_lock_irqsave, interrupts remain disabled while spinning. In other architectures like x86 and powerpc, interrupts are re-enabled while spinning if IRQ is not masked before spin_lock_irqsave is called. The following patch re-enables interrupts through local_irq_restore while spinning for a lock acquisition. This can improve system response. [heiko.carstens@de.ibm.com: removed saving of pc] Signed-off-by: Hisashi Hifumi <hifumi.hisashi@oss.ntt.co.jp> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-01-26[S390] Remove owner_pc member from raw_spinlock_t.Heiko Carstens1-8/+4
Used to contain the address of the holder of the lock. But since the spinlock code is not inlined anymore all locks contain the same address anyway. And since in addtition nobody complained about that for ages its obviously unused. So remove it. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2007-10-22[S390] 4level-fixup cleanupMartin Schwidefsky1-1/+6
Get independent from asm-generic/4level-fixup.h Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2007-10-22[S390] Introduce follow_table in uaccess_pt.cMartin Schwidefsky1-63/+22
Define and use follow_table inline in uaccess_pt.c to simplify the code. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2007-10-19pid namespaces: define is_global_init() and is_container_init()Serge E. Hallyn1-1/+1
is_init() is an ambiguous name for the pid==1 check. Split it into is_global_init() and is_container_init(). A cgroup init has it's tsk->pid == 1. A global init also has it's tsk->pid == 1 and it's active pid namespace is the init_pid_ns. But rather than check the active pid namespace, compare the task structure with 'init_pid_ns.child_reaper', which is initialized during boot to the /sbin/init process and never changes. Changelog: 2.6.22-rc4-mm2-pidns1: - Use 'init_pid_ns.child_reaper' to determine if a given task is the global init (/sbin/init) process. This would improve performance and remove dependence on the task_pid(). 2.6.21-mm2-pidns2: - [Sukadev Bhattiprolu] Changed is_container_init() calls in {powerpc, ppc,avr32}/traps.c for the _exception() call to is_global_init(). This way, we kill only the cgroup if the cgroup's init has a bug rather than force a kernel panic. [akpm@linux-foundation.org: fix comment] [sukadev@us.ibm.com: Use is_global_init() in arch/m32r/mm/fault.c] [bunk@stusta.de: kernel/pid.c: remove unused exports] [sukadev@us.ibm.com: Fix capability.c to work with threaded init] Signed-off-by: Serge E. Hallyn <serue@us.ibm.com> Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com> Acked-by: Pavel Emelianov <xemul@openvz.org> Cc: Eric W. Biederman <ebiederm@xmission.com> Cc: Cedric Le Goater <clg@fr.ibm.com> Cc: Dave Hansen <haveblue@us.ibm.com> Cc: Herbert Poetzel <herbert@13thfloor.at> Cc: Kirill Korotaev <dev@sw.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-19mm: fault feedback #2Nick Piggin1-12/+11
This patch completes Linus's wish that the fault return codes be made into bit flags, which I agree makes everything nicer. This requires requires all handle_mm_fault callers to be modified (possibly the modifications should go further and do things like fault accounting in handle_mm_fault -- however that would be for another patch). [akpm@linux-foundation.org: fix alpha build] [akpm@linux-foundation.org: fix s390 build] [akpm@linux-foundation.org: fix sparc build] [akpm@linux-foundation.org: fix sparc64 build] [akpm@linux-foundation.org: fix ia64 build] Signed-off-by: Nick Piggin <npiggin@suse.de> Cc: Richard Henderson <rth@twiddle.net> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Cc: Russell King <rmk@arm.linux.org.uk> Cc: Ian Molton <spyro@f2s.com> Cc: Bryan Wu <bryan.wu@analog.com> Cc: Mikael Starvik <starvik@axis.com> Cc: David Howells <dhowells@redhat.com> Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Cc: "Luck, Tony" <tony.luck@intel.com> Cc: Hirokazu Takata <takata@linux-m32r.org> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Roman Zippel <zippel@linux-m68k.org> Cc: Greg Ungerer <gerg@uclinux.org> Cc: Matthew Wilcox <willy@debian.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Paul Mundt <lethal@linux-sh.org> Cc: Kazumoto Kojima <kkojima@rr.iij4u.or.jp> Cc: Richard Curnow <rc@rc0.org.uk> Cc: William Lee Irwin III <wli@holomorphy.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Jeff Dike <jdike@addtoit.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Cc: Miles Bader <uclinux-v850@lsi.nec.co.jp> Cc: Chris Zankel <chris@zankel.net> Acked-by: Kyle McMartin <kyle@mcmartin.ca> Acked-by: Haavard Skinnemoen <hskinnemoen@atmel.com> Acked-by: Ralf Baechle <ralf@linux-mips.org> Acked-by: Andi Kleen <ak@muc.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> [ Still apparently needs some ARM and PPC loving - Linus ] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-10[S390] Bogomips calculation for 64 bit.Martin Schwidefsky1-2/+2
The bogomips calculation triggered via reading from /proc/cpuinfo can return incorrect values if the qrnnd assembly is called with a pointer in %r2 with any of the upper 32 bits set. Fix this by using 64 bit division / remainder operation provided by gcc instead of calling the assembly. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2007-04-25[S390]: Fix build on 31-bit.David S. Miller2-3/+1
Allow s390 to properly override the generic __div64_32() implementation by: 1) Using obj-y for div64.o in s390's makefile instead of lib-y 2) Adding the weak attribute to the generic implementation. Signed-off-by: David S. Miller <davem@davemloft.net>
2007-02-21[S390] prevent softirqs if delay is called disabledMartin Schwidefsky1-0/+7
The new delay implementation uses the clock comparator and an external interrupt even if it is called disabled for interrupts. To do this all external interrupt source except clock comparator are switched of before enabling external interrupts. The external interrupt at the end of the delay period may not execute softirqs or we can end up in a dead-lock. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2007-02-05[S390] Avoid excessive inlining.Heiko Carstens1-5/+5
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2007-02-05[S390] Calibrate delay and bogomips.Martin Schwidefsky2-1/+78
Preset the bogomips number to the cpu capacity value reported by store system information in SYSIB 1.2.2. This value is constant for a particular machine model and can be used to determine relative performance differences between machines. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2007-02-05[S390] ETR support.Martin Schwidefsky1-14/+34
This patch adds support for clock synchronization to an external time reference (ETR). The external time reference sends an oscillator signal and a synchronization signal every 2^20 microseconds to keep the TOD clocks of all connected servers in sync. For availability two ETR units can be connected to a machine. If the clock deviates for more than the sync-check tolerance all cpus get a machine check that indicates that the clock is out of sync. For the lovely details how to get the clock back in sync see the code below. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2007-02-05[S390] noexec protectionGerald Schaefer2-1/+372
This provides a noexec protection on s390 hardware. Our hardware does not have any bits left in the pte for a hw noexec bit, so this is a different approach using shadow page tables and a special addressing mode that allows separate address spaces for code and data. As a special feature of our "secondary-space" addressing mode, separate page tables can be specified for the translation of data addresses (storage operands) and instruction addresses. The shadow page table is used for the instruction addresses and the standard page table for the data addresses. The shadow page table is linked to the standard page table by a pointer in page->lru.next of the struct page corresponding to the page that contains the standard page table (since page->private is not really private with the pte_lock and the page table pages are not in the LRU list). Depending on the software bits of a pte, it is either inserted into both page tables or just into the standard (data) page table. Pages of a vma that does not have the VM_EXEC bit set get mapped only in the data address space. Any try to execute code on such a page will cause a page translation exception. The standard reaction to this is a SIGSEGV with two exceptions: the two system call opcodes 0x0a77 (sys_sigreturn) and 0x0aad (sys_rt_sigreturn) are allowed. They are stored by the kernel to the signal stack frame. Unfortunately, the signal return mechanism cannot be modified to use an SA_RESTORER because the exception unwinding code depends on the system call opcode stored behind the signal stack frame. This feature requires that user space is executed in secondary-space mode and the kernel in home-space mode, which means that the addressing modes need to be switched and that the noexec protection only works for user space. After switching the addressing modes, we cannot use the mvcp/mvcs instructions anymore to copy between kernel and user space. A new mvcos instruction has been added to the z9 EC/BC hardware which allows to copy between arbitrary address spaces, but on older hardware the page tables need to be walked manually. Signed-off-by: Gerald Schaefer <geraldsc@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2007-02-05[S390] Get rid of a lot of sparse warnings.Heiko Carstens4-27/+47
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2007-01-09[S390] don't call handle_mm_fault() if in an atomic context.Heiko Carstens2-3/+3
There are several places in the futex code where a spin_lock is held and still uaccesses happen. Deadlocks are avoided by increasing the preempt count. The pagefault handler will then not take any locks but will immediately search the fixup tables. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2006-12-08[S390] uaccess_pt: add missing down_read() and convert to is_init().Heiko Carstens1-2/+3
Doesn't seem to be a good idea to duplicate code :) Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2006-12-07[PATCH] mm: pagefault_{disable,enable}()Peter Zijlstra1-3/+3
Introduce pagefault_{disable,enable}() and use these where previously we did manual preempt increments/decrements to make the pagefault handler do the atomic thing. Currently they still rely on the increased preempt count, but do not rely on the disabled preemption, this might go away in the future. (NOTE: the extra barrier() in pagefault_disable might fix some holes on machines which have too many registers for their own good) [heiko.carstens@de.ibm.com: s390 fix] Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Acked-by: Nick Piggin <npiggin@suse.de> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-12-04[S390] Add dynamic size check for usercopy functions.Gerald Schaefer4-59/+190
Use a wrapper for copy_to/from_user to chose the best usercopy method. The mvcos instruction is better for sizes greater than 256 bytes, if mvcos is not available a page table walk is better for sizes greater than 1024 bytes. Also removed the redundant copy_to/from_user_std_small functions. Signed-off-by: Gerald Schaefer <geraldsc@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2006-10-01[PATCH] Directed yield: direct yield of spinlocks for s390.Martin Schwidefsky1-23/+39
Use the new diagnose 0x9c in the spinlock implementation for s390. It yields the remaining timeslice of the virtual cpu that tries to acquire a lock to the virtual cpu that is the current holder of the lock. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-28[S390] Inline assembly cleanup.Martin Schwidefsky1-7/+4
Major cleanup of all s390 inline assemblies. They now have a common coding style. Quite a few have been shortened, mainly by using register asm variables. Use of the EX_TABLE macro helps as well. The atomic ops, bit ops and locking inlines new use the Q-constraint if a newer gcc is used. That results in slightly better code. Thanks to Christian Borntraeger for proof reading the changes. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2006-09-28[S390] user readable uninitialised kernel memory.Martin Schwidefsky2-16/+42
A user space program can read uninitialised kernel memory by appending to a file from a bad address and then reading the result back. The cause is the copy_from_user function that does not clear the remaining bytes of the kernel buffer after it got a fault on the user space address. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2006-09-28[S390] __div64_32 for 31 bit.Martin Schwidefsky2-0/+152
The clocksource infrastructure introduced with commit ad596171ed635c51a9eef829187af100cbf8dcf7 broke 31 bit s390. The reason is that the do_div() primitive for 31 bit always had a restriction: it could only divide an unsigned 64 bit integer by an unsigned 31 bit integer. The clocksource code now uses do_div() with a base value that has the most significant bit set. The result is that clock->cycle_interval has a funny value which causes the linux time to jump around like mad. The solution is "obvious": implement a proper __div64_32 function for 31 bit s390. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2006-09-20[S390] Use alternative user-copy operations for new hardware.Gerald Schaefer2-0/+157
This introduces new user-copy operations which are optimized for copying more than 256 Bytes on new hardware. Signed-off-by: Gerald Schaefer <geraldsc@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2006-09-20[S390] Make user-copy operations run-time configurable.Gerald Schaefer4-420/+341
Introduces a struct uaccess_ops which allows setting user-copy operations at run-time. Signed-off-by: Gerald Schaefer <geraldsc@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2006-08-30[S390] broken copy_in_user function.Martin Schwidefsky2-33/+35
The copy_in_user primitive does not work as advertised. If the source and target area are available copy_in_user copies one byte too much. If one of the memory areas is not available it does not copy as much data as it can, but up to 257 bytes less. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2006-07-12[S390] Fix sparse warnings.Heiko Carstens1-2/+2
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2006-06-30Remove obsolete #include <linux/config.h>Jörn Engel1-1/+0
Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de> Signed-off-by: Adrian Bunk <bunk@stusta.de>
2006-03-09[PATCH] s390: Increase spinlock retry code performanceChristian Ehrhardt1-2/+13
Currently the code tries up to spin_retry times to grab a lock using the cs instruction. The cs instruction has exclusive access to a memory region and therefore invalidates the appropiate cache line of all other cpus. If there is contention on a lock this leads to cache line trashing. This can be avoided if we first check wether a cs instruction is likely to succeed before the instruction gets actually executed. Signed-off-by: Christian Ehrhardt <ehrhardt@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-08[PATCH] s390: fix strnlen_user return valueGerald Schaefer2-6/+6
strnlen_user is supposed to return then length count + 1 if no terminating \0 is found, and it should return 0 on exception. Found by David Howells <dhowells@redhat.com>. Signed-off-by: Gerald Schaefer <geraldsc@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Acked-By: David Howells <dhowells@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-14[PATCH] s390: fix __delay implementationHeiko Carstens1-1/+1
Fix __delay implementation. Called with an argument "1" or "0" it would loop nearly forever (since (1/2)-1 = 0xffffffff). Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>