/* * Tests for prctl(PR_GET_TSC, ...) / prctl(PR_SET_TSC, ...) * * Basic test to test behaviour of PR_GET_TSC and PR_SET_TSC */ #include #include #include #include #include #include #include /* Get/set the process' ability to use the timestamp counter instruction */ #ifndef PR_GET_TSC #define PR_GET_TSC 25 #define PR_SET_TSC 26 # define PR_TSC_ENABLE 1 /* allow the use of the timestamp counter */ # define PR_TSC_SIGSEGV 2 /* throw a SIGSEGV instead of reading the TSC */ #endif const char *tsc_names[] = { [0] = "[not set]", [PR_TSC_ENABLE] = "PR_TSC_ENABLE", [PR_TSC_SIGSEGV] = "PR_TSC_SIGSEGV", }; static uint64_t rdtsc(void) { uint32_t lo, hi; /* We cannot use "=A", since this would use %rax on x86_64 */ __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); return (uint64_t)hi << 32 | lo; } static void sigsegv_cb(int sig) { int tsc_val = 0; printf("[ SIG_SEGV ]\n"); printf("prctl(PR_GET_TSC, &tsc_val); "); fflush(stdout); if ( prctl(PR_GET_TSC, &tsc_val) == -1) perror("prctl"); printf("tsc_val == %s\n", tsc_names[tsc_val]); printf("prctl(PR_SET_TSC, PR_TSC_ENABLE)\n"); fflush(stdout); if ( prctl(PR_SET_TSC, PR_TSC_ENABLE) == -1) perror("prctl"); printf("rdtsc() == "); } int main(void) { int tsc_val = 0; signal(SIGSEGV, sigsegv_cb); printf("rdtsc() == %llu\n", (unsigned long long)rdtsc()); printf("prctl(PR_GET_TSC, &tsc_val); "); fflush(stdout); if ( prctl(PR_GET_TSC, &tsc_val) == -1) perror("prctl"); printf("tsc_val == %s\n", tsc_names[tsc_val]); printf("rdtsc() == %llu\n", (unsigned long long)rdtsc()); printf("prctl(PR_SET_TSC, PR_TSC_ENABLE)\n"); fflush(stdout); if ( prctl(PR_SET_TSC, PR_TSC_ENABLE) == -1) perror("prctl"); printf("rdtsc() == %llu\n", (unsigned long long)rdtsc()); printf("prctl(PR_SET_TSC, PR_TSC_SIGSEGV)\n"); fflush(stdout); if ( prctl(PR_SET_TSC, PR_TSC_SIGSEGV) == -1) perror("prctl"); printf("rdtsc() == "); fflush(stdout); printf("%llu\n", (unsigned long long)rdtsc()); fflush(stdout); exit(EXIT_SUCCESS); } od='get' action='/cgit.cgi/linux/net-next.git/log/include/crypto/sha3.h'>
diff options
context:
space:
mode:
authorEyal Itkin <eyal.itkin@gmail.com>2017-02-07 16:43:05 +0300
committerDoug Ledford <dledford@redhat.com>2017-02-08 12:28:30 -0500
commit628f07d33c1f2e7bf31e0a4a988bb07914bd5e73 (patch)
treec228c66498f9a4562093fbbf80a41bcede0c06f2 /include/crypto/sha3.h
parentb4cfe3971f6eab542dd7ecc398bfa1aeec889934 (diff)
IB/rxe: Fix resid update
Update the response's resid field when larger than MTU, instead of only updating the local resid variable. Fixes: 8700e3e7c485 ("Soft RoCE driver") Signed-off-by: Eyal Itkin <eyal.itkin@gmail.com> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'include/crypto/sha3.h')