/* * POWER Data Stream Control Register (DSCR) sysfs interface test * * This test updates to system wide DSCR default through the sysfs interface * and then verifies that all the CPU specific DSCR defaults are updated as * well verified from their sysfs interfaces. * * Copyright 2015, Anshuman Khandual, IBM Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published * by the Free Software Foundation. */ #include "dscr.h" static int check_cpu_dscr_default(char *file, unsigned long val) { char buf[10]; int fd, rc; fd = open(file, O_RDWR); if (fd == -1) { perror("open() failed"); return 1; } rc = read(fd, buf, sizeof(buf)); if (rc == -1) { perror("read() failed"); return 1; } close(fd); buf[rc] = '\0'; if (strtol(buf, NULL, 16) != val) { printf("DSCR match failed: %ld (system) %ld (cpu)\n", val, strtol(buf, NULL, 16)); return 1; } return 0; } static int check_all_cpu_dscr_defaults(unsigned long val) { DIR *sysfs; struct dirent *dp; char file[LEN_MAX]; sysfs = opendir(CPU_PATH); if (!sysfs) { perror("opendir() failed"); return 1; } while ((dp = readdir(sysfs))) { if (!(dp->d_type & DT_DIR)) continue; if (!strcmp(dp->d_name, "cpuidle")) continue; if (!strstr(dp->d_name, "cpu")) continue; sprintf(file, "%s%s/dscr", CPU_PATH, dp->d_name); if (access(file, F_OK)) continue; if (check_cpu_dscr_default(file, val)) return 1; } closedir(sysfs); return 0; } int dscr_sysfs(void) { unsigned long orig_dscr_default; int i, j; orig_dscr_default = get_default_dscr(); for (i = 0; i < COUNT; i++) { for (j = 0; j < DSCR_MAX; j++) { set_default_dscr(j); if (check_all_cpu_dscr_defaults(j)) goto fail; } } set_default_dscr(orig_dscr_default); return 0; fail: set_default_dscr(orig_dscr_default); return 1; } int main(int argc, char *argv[]) { return test_harness(dscr_sysfs, "dscr_sysfs_test"); } an/Makefile?id=9eb7aa891101a4a09114ff3191f9877ea35eae06'>commitdiff
path: root/tools/testing/selftests/powerpc/switch_endian/Makefile
='label'>mode:
AgeCommit message (Expand)AuthorFilesLines
authorRabin Vincent <rabinv@axis.com>2017-01-13 15:00:16 +0100
committerSteve French <smfrench@gmail.com>2017-01-14 14:58:29 -0600
commit81ddd8c0c5e1cb41184d66567140cb48c53eb3d1 (patch)
tree5775397665161f633952a13537df36df682f7218 /fs/xfs/xfs_globals.c
parent2eabb8b8d68bc9c7779ba8b04bec8d4f8baed0bc (diff)
cifs: initialize file_info_lock
Reviewed-by: Jeff Layton <jlayton@redhat.com> CC: Stable <stable@vger.kernel.org> file_info_lock is not initalized in initiate_cifs_search(), leading to the following splat after a simple "mount.cifs ... dir && ls dir/": BUG: spinlock bad magic on CPU#0, ls/486 lock: 0xffff880009301110, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0 CPU: 0 PID: 486 Comm: ls Not tainted 4.9.0 #27 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996) ffffc900042f3db0 ffffffff81327533 0000000000000000 ffff880009301110 ffffc900042f3dd0 ffffffff810baf75 ffff880009301110 ffffffff817ae077 ffffc900042f3df0 ffffffff810baff6 ffff880009301110 ffff880008d69900 Call Trace: [<ffffffff81327533>] dump_stack+0x65/0x92 [<ffffffff810baf75>] spin_dump+0x85/0xe0 [<ffffffff810baff6>] spin_bug+0x26/0x30 [<ffffffff810bb159>] do_raw_spin_lock+0xe9/0x130 [<ffffffff8159ad2f>] _raw_spin_lock+0x1f/0x30 [<ffffffff8127e50d>] cifs_closedir+0x4d/0x100 [<ffffffff81181cfd>] __fput+0x5d/0x160 [<ffffffff81181e3e>] ____fput+0xe/0x10 [<ffffffff8109410e>] task_work_run+0x7e/0xa0 [<ffffffff81002512>] exit_to_usermode_loop+0x92/0xa0 [<ffffffff810026f9>] syscall_return_slowpath+0x49/0x50 [<ffffffff8159b484>] entry_SYSCALL_64_fastpath+0xa7/0xa9 Fixes: 3afca265b5f53a0 ("Clarify locking of cifs file and tcon structures and make more granular") Signed-off-by: Rabin Vincent <rabinv@axis.com> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/xfs/xfs_globals.c')