Merge tag 'powerpc-4.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mpe/linux
Pull powerpc updates from Michael Ellerman: - Numerous minor fixes, cleanups etc. - More EEH work from Gavin to remove its dependency on device_nodes. - Memory hotplug implemented entirely in the kernel from Nathan Fontenot. - Removal of redundant CONFIG_PPC_OF by Kevin Hao. - Rewrite of VPHN parsing logic & tests from Greg Kurz. - A fix from Nish Aravamudan to reduce memory usage by clamping nodes_possible_map. - Support for pstore on powernv from Hari Bathini. - Removal of old powerpc specific byte swap routines by David Gibson. - Fix from Vasant Hegde to prevent the flash driver telling you it was flashing your firmware when it wasn't. - Patch from Ben Herrenschmidt to add an OPAL heartbeat driver. - Fix for an oops causing get/put_cpu_var() imbalance in perf by Jan Stancek. - Some fixes for migration from Tyrel Datwyler. - A new syscall to switch the cpu endian by Michael Ellerman. - Large series from Wei Yang to implement SRIOV, reviewed and acked by Bjorn. - A fix for the OPAL sensor driver from Cédric Le Goater. - Fixes to get STRICT_MM_TYPECHECKS building again by Michael Ellerman. - Large series from Daniel Axtens to make our PCI hooks per PHB rather than per machine. - Small patch from Sam Bobroff to explicitly abort non-suspended transactions on syscalls, plus a test to exercise it. - Numerous reworks and fixes for the 24x7 PMU from Sukadev Bhattiprolu. - Small patch to enable the hard lockup detector from Anton Blanchard. - Fix from Dave Olson for missing L2 cache information on some CPUs. - Some fixes from Michael Ellerman to get Cell machines booting again. - Freescale updates from Scott: Highlights include BMan device tree nodes, an MSI erratum workaround, a couple minor performance improvements, config updates, and misc fixes/cleanup. * tag 'powerpc-4.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mpe/linux: (196 commits) powerpc/powermac: Fix build error seen with powermac smp builds powerpc/pseries: Fix compile of memory hotplug without CONFIG_MEMORY_HOTREMOVE powerpc: Remove PPC32 code from pseries specific find_and_init_phbs() powerpc/cell: Fix iommu breakage caused by controller_ops change powerpc/eeh: Fix crash in eeh_add_device_early() on Cell powerpc/perf: Cap 64bit userspace backtraces to PERF_MAX_STACK_DEPTH powerpc/perf/hv-24x7: Fail 24x7 initcall if create_events_from_catalog() fails powerpc/pseries: Correct memory hotplug locking powerpc: Fix missing L2 cache size in /sys/devices/system/cpu powerpc: Add ppc64 hard lockup detector support oprofile: Disable oprofile NMI timer on ppc64 powerpc/perf/hv-24x7: Add missing put_cpu_var() powerpc/perf/hv-24x7: Break up single_24x7_request powerpc/perf/hv-24x7: Define update_event_count() powerpc/perf/hv-24x7: Whitespace cleanup powerpc/perf/hv-24x7: Define add_event_to_24x7_request() powerpc/perf/hv-24x7: Rename hv_24x7_event_update powerpc/perf/hv-24x7: Move debug prints to separate function powerpc/perf/hv-24x7: Drop event_24x7_request() powerpc/perf/hv-24x7: Use pr_devel() to log message ... Conflicts: tools/testing/selftests/powerpc/Makefile tools/testing/selftests/powerpc/tm/Makefile
This commit is contained in:
@@ -1 +1,2 @@
|
||||
tm-resched-dscr
|
||||
tm-syscall
|
||||
|
@@ -1,9 +1,12 @@
|
||||
TEST_PROGS := tm-resched-dscr
|
||||
TEST_PROGS := tm-resched-dscr tm-syscall
|
||||
|
||||
all: $(TEST_PROGS)
|
||||
|
||||
$(TEST_PROGS): ../harness.c
|
||||
|
||||
tm-syscall: tm-syscall-asm.S
|
||||
tm-syscall: CFLAGS += -mhtm
|
||||
|
||||
include ../../lib.mk
|
||||
|
||||
clean:
|
||||
|
27
tools/testing/selftests/powerpc/tm/tm-syscall-asm.S
Normal file
27
tools/testing/selftests/powerpc/tm/tm-syscall-asm.S
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <ppc-asm.h>
|
||||
#include <asm/unistd.h>
|
||||
|
||||
.text
|
||||
FUNC_START(getppid_tm_active)
|
||||
tbegin.
|
||||
beq 1f
|
||||
li r0, __NR_getppid
|
||||
sc
|
||||
tend.
|
||||
blr
|
||||
1:
|
||||
li r3, -1
|
||||
blr
|
||||
|
||||
FUNC_START(getppid_tm_suspended)
|
||||
tbegin.
|
||||
beq 1f
|
||||
li r0, __NR_getppid
|
||||
tsuspend.
|
||||
sc
|
||||
tresume.
|
||||
tend.
|
||||
blr
|
||||
1:
|
||||
li r3, -1
|
||||
blr
|
121
tools/testing/selftests/powerpc/tm/tm-syscall.c
Normal file
121
tools/testing/selftests/powerpc/tm/tm-syscall.c
Normal file
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* Copyright 2015, Sam Bobroff, IBM Corp.
|
||||
* Licensed under GPLv2.
|
||||
*
|
||||
* Test the kernel's system call code to ensure that a system call
|
||||
* made from within an active HTM transaction is aborted with the
|
||||
* correct failure code.
|
||||
* Conversely, ensure that a system call made from within a
|
||||
* suspended transaction can succeed.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <asm/tm.h>
|
||||
#include <asm/cputable.h>
|
||||
#include <linux/auxvec.h>
|
||||
#include <sys/time.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
extern int getppid_tm_active(void);
|
||||
extern int getppid_tm_suspended(void);
|
||||
|
||||
unsigned retries = 0;
|
||||
|
||||
#define TEST_DURATION 10 /* seconds */
|
||||
#define TM_RETRIES 100
|
||||
|
||||
long failure_code(void)
|
||||
{
|
||||
return __builtin_get_texasru() >> 24;
|
||||
}
|
||||
|
||||
bool failure_is_persistent(void)
|
||||
{
|
||||
return (failure_code() & TM_CAUSE_PERSISTENT) == TM_CAUSE_PERSISTENT;
|
||||
}
|
||||
|
||||
bool failure_is_syscall(void)
|
||||
{
|
||||
return (failure_code() & TM_CAUSE_SYSCALL) == TM_CAUSE_SYSCALL;
|
||||
}
|
||||
|
||||
pid_t getppid_tm(bool suspend)
|
||||
{
|
||||
int i;
|
||||
pid_t pid;
|
||||
|
||||
for (i = 0; i < TM_RETRIES; i++) {
|
||||
if (suspend)
|
||||
pid = getppid_tm_suspended();
|
||||
else
|
||||
pid = getppid_tm_active();
|
||||
|
||||
if (pid >= 0)
|
||||
return pid;
|
||||
|
||||
if (failure_is_persistent()) {
|
||||
if (failure_is_syscall())
|
||||
return -1;
|
||||
|
||||
printf("Unexpected persistent transaction failure.\n");
|
||||
printf("TEXASR 0x%016lx, TFIAR 0x%016lx.\n",
|
||||
__builtin_get_texasr(), __builtin_get_tfiar());
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
retries++;
|
||||
}
|
||||
|
||||
printf("Exceeded limit of %d temporary transaction failures.\n", TM_RETRIES);
|
||||
printf("TEXASR 0x%016lx, TFIAR 0x%016lx.\n",
|
||||
__builtin_get_texasr(), __builtin_get_tfiar());
|
||||
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
int tm_syscall(void)
|
||||
{
|
||||
unsigned count = 0;
|
||||
struct timeval end, now;
|
||||
|
||||
SKIP_IF(!((long)get_auxv_entry(AT_HWCAP2) & PPC_FEATURE2_HTM));
|
||||
setbuf(stdout, NULL);
|
||||
|
||||
printf("Testing transactional syscalls for %d seconds...\n", TEST_DURATION);
|
||||
|
||||
gettimeofday(&end, NULL);
|
||||
now.tv_sec = TEST_DURATION;
|
||||
now.tv_usec = 0;
|
||||
timeradd(&end, &now, &end);
|
||||
|
||||
for (count = 0; timercmp(&now, &end, <); count++) {
|
||||
/*
|
||||
* Test a syscall within a suspended transaction and verify
|
||||
* that it succeeds.
|
||||
*/
|
||||
FAIL_IF(getppid_tm(true) == -1); /* Should succeed. */
|
||||
|
||||
/*
|
||||
* Test a syscall within an active transaction and verify that
|
||||
* it fails with the correct failure code.
|
||||
*/
|
||||
FAIL_IF(getppid_tm(false) != -1); /* Should fail... */
|
||||
FAIL_IF(!failure_is_persistent()); /* ...persistently... */
|
||||
FAIL_IF(!failure_is_syscall()); /* ...with code syscall. */
|
||||
gettimeofday(&now, 0);
|
||||
}
|
||||
|
||||
printf("%d active and suspended transactions behaved correctly.\n", count);
|
||||
printf("(There were %d transaction retries.)\n", retries);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return test_harness(tm_syscall, "tm_syscall");
|
||||
}
|
Reference in New Issue
Block a user