/* * media_device_test.c - Media Controller Device ioctl loop Test * * Copyright (c) 2016 Shuah Khan * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * This file is released under the GPLv2. */ /* * This file adds a test for Media Controller API. * This test should be run as root and should not be * included in the Kselftest run. This test should be * run when hardware and driver that makes use Media * Controller API are present in the system. * * This test opens user specified Media Device and calls * MEDIA_IOC_DEVICE_INFO ioctl in a loop once every 10 * seconds. * * Usage: * sudo ./media_device_test -d /dev/mediaX * * While test is running, remove the device and * ensure there are no use after free errors and * other Oops in the dmesg. Enable KaSan kernel * config option for use-after-free error detection. */ #include #include #include #include #include #include #include #include #include #include int main(int argc, char **argv) { int opt; char media_device[256]; int count; struct media_device_info mdi; int ret; int fd; if (argc < 2) { printf("Usage: %s [-d ]\n", argv[0]); exit(-1); } /* Process arguments */ while ((opt = getopt(argc, argv, "d:")) != -1) { switch (opt) { case 'd': strncpy(media_device, optarg, sizeof(media_device) - 1); media_device[sizeof(media_device)-1] = '\0'; break; default: printf("Usage: %s [-d ]\n", argv[0]); exit(-1); } } if (getuid() != 0) { printf("Please run the test as root - Exiting.\n"); exit(-1); } /* Generate random number of interations */ srand((unsigned int) time(NULL)); count = rand(); /* Open Media device and keep it open */ fd = open(media_device, O_RDWR); if (fd == -1) { printf("Media Device open errno %s\n", strerror(errno)); exit(-1); } printf("\nNote:\n" "While test is running, remove the device and\n" "ensure there are no use after free errors and\n" "other Oops in the dmesg. Enable KaSan kernel\n" "config option for use-after-free error detection.\n\n"); printf("Running test for %d iternations\n", count); while (count > 0) { ret = ioctl(fd, MEDIA_IOC_DEVICE_INFO, &mdi); if (ret < 0) printf("Media Device Info errno %s\n", strerror(errno)); else printf("Media device model %s driver %s - count %d\n", mdi.model, mdi.driver, count); sleep(10); count--; } }
e='3' selected='selected'>3
AgeCommit message (Expand)AuthorFilesLines
space:
mode:
authorDexuan Cui <decui@microsoft.com>2017-01-28 11:46:02 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-01-31 10:59:48 +0100
commit433e19cf33d34bb6751c874a9c00980552fe508c (patch)
treece6547ef2987fbb289fa28f03536328a42781651 /sound/core/seq/seq_lock.c
parent191e885a2e130e639bb0c8ee350d7047294f2ce6 (diff)
Drivers: hv: vmbus: finally fix hv_need_to_signal_on_read()
Commit a389fcfd2cb5 ("Drivers: hv: vmbus: Fix signaling logic in hv_need_to_signal_on_read()") added the proper mb(), but removed the test "prev_write_sz < pending_sz" when making the signal decision. As a result, the guest can signal the host unnecessarily, and then the host can throttle the guest because the host thinks the guest is buggy or malicious; finally the user running stress test can perceive intermittent freeze of the guest. This patch brings back the test, and properly handles the in-place consumption APIs used by NetVSC (see get_next_pkt_raw(), put_pkt_raw() and commit_rd_index()). Fixes: a389fcfd2cb5 ("Drivers: hv: vmbus: Fix signaling logic in hv_need_to_signal_on_read()") Signed-off-by: Dexuan Cui <decui@microsoft.com> Reported-by: Rolf Neugebauer <rolf.neugebauer@docker.com> Tested-by: Rolf Neugebauer <rolf.neugebauer@docker.com> Cc: "K. Y. Srinivasan" <kys@microsoft.com> Cc: Haiyang Zhang <haiyangz@microsoft.com> Cc: Stephen Hemminger <sthemmin@microsoft.com> Cc: <stable@vger.kernel.org> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound/core/seq/seq_lock.c')