/* cpufreq-bench CPUFreq microbenchmark * * Copyright (C) 2008 Christian Kornacker * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include #include #include #include #include "config.h" #include "system.h" #include "benchmark.h" static struct option long_options[] = { {"output", 1, 0, 'o'}, {"sleep", 1, 0, 's'}, {"load", 1, 0, 'l'}, {"verbose", 0, 0, 'v'}, {"cpu", 1, 0, 'c'}, {"governor", 1, 0, 'g'}, {"prio", 1, 0, 'p'}, {"file", 1, 0, 'f'}, {"cycles", 1, 0, 'n'}, {"rounds", 1, 0, 'r'}, {"load-step", 1, 0, 'x'}, {"sleep-step", 1, 0, 'y'}, {"help", 0, 0, 'h'}, {0, 0, 0, 0} }; /******************************************************************* usage *******************************************************************/ void usage() { printf("usage: ./bench\n"); printf("Options:\n"); printf(" -l, --load=\t\tinitial load time in us\n"); printf(" -s, --sleep=\t\tinitial sleep time in us\n"); printf(" -x, --load-step=\ttime to be added to load time, in us\n"); printf(" -y, --sleep-step=\ttime to be added to sleep time, in us\n"); printf(" -c, --cpu=\t\t\tCPU Nr. to use, starting at 0\n"); printf(" -p, --prio=\t\t\tscheduler priority, HIGH, LOW or DEFAULT\n"); printf(" -g, --governor=\t\tcpufreq governor to test\n"); printf(" -n, --cycles=\t\t\tload/sleep cycles\n"); printf(" -r, --rounds\t\t\tload/sleep rounds\n"); printf(" -f, --file=\t\tconfig file to use\n"); printf(" -o, --output=\t\t\toutput path. Filename will be OUTPUTPATH/benchmark_TIMESTAMP.log\n"); printf(" -v, --verbose\t\t\t\tverbose output on/off\n"); printf(" -h, --help\t\t\t\tPrint this help screen\n"); exit(1); } /******************************************************************* main *******************************************************************/ int main(int argc, char **argv) { int c; int option_index = 0; struct config *config = NULL; config = prepare_default_config(); if (config == NULL) return EXIT_FAILURE; while (1) { c = getopt_long (argc, argv, "hg:o:s:l:vc:p:f:n:r:x:y:", long_options, &option_index); if (c == -1) break; switch (c) { case 'o': if (config->output != NULL) fclose(config->output); config->output = prepare_output(optarg); if (config->output == NULL) return EXIT_FAILURE; dprintf("user output path -> %s\n", optarg); break; case 's': sscanf(optarg, "%li", &config->sleep); dprintf("user sleep time -> %s\n", optarg); break; case 'l': sscanf(optarg, "%li", &config->load); dprintf("user load time -> %s\n", optarg); break; case 'c': sscanf(optarg, "%u", &config->cpu); dprintf("user cpu -> %s\n", optarg); break; case 'g': strncpy(config->governor, optarg, 14); dprintf("user governor -> %s\n", optarg); break; case 'p': if (string_to_prio(optarg) != SCHED_ERR) { config->prio = string_to_prio(optarg); dprintf("user prio -> %s\n", optarg); } else { if (config != NULL) { if (config->output != NULL) fclose(config->output); free(config); } usage(); } break; case 'n': sscanf(optarg, "%u", &config->cycles); dprintf("user cycles -> %s\n", optarg); break; case 'r': sscanf(optarg, "%u", &config->rounds); dprintf("user rounds -> %s\n", optarg); break; case 'x': sscanf(optarg, "%li", &config->load_step); dprintf("user load_step -> %s\n", optarg); break; case 'y': sscanf(optarg, "%li", &config->sleep_step); dprintf("user sleep_step -> %s\n", optarg); break; case 'f': if (prepare_config(optarg, config)) return EXIT_FAILURE; break; case 'v': config->verbose = 1; dprintf("verbose output enabled\n"); break; case 'h': case '?': default: if (config != NULL) { if (config->output != NULL) fclose(config->output); free(config); } usage(); } } if (config->verbose) { printf("starting benchmark with parameters:\n"); printf("config:\n\t" "sleep=%li\n\t" "load=%li\n\t" "sleep_step=%li\n\t" "load_step=%li\n\t" "cpu=%u\n\t" "cycles=%u\n\t" "rounds=%u\n\t" "governor=%s\n\n", config->sleep, config->load, config->sleep_step, config->load_step, config->cpu, config->cycles, config->rounds, config->governor); } prepare_user(config); prepare_system(config); start_benchmark(config); if (config->output != stdout) fclose(config->output); free(config); return EXIT_SUCCESS; } it.cgi/linux/net-next.git/tree/?id=c8f325a59cfc718d13a50fbc746ed9b415c25e92'>d53fbdac9d0781e39a13b2ac6b2bd258cf3b4140 /sound/pci/trident/trident_main.c parentbf29bddf0417a4783da3b24e8c9e017ac649326f (diff)
efi/fdt: Avoid FDT manipulation after ExitBootServices()
Some AArch64 UEFI implementations disable the MMU in ExitBootServices(), after which unaligned accesses to RAM are no longer supported. Commit: abfb7b686a3e ("efi/libstub/arm*: Pass latest memory map to the kernel") fixed an issue in the memory map handling of the stub FDT code, but inadvertently created an issue with such firmware, by moving some of the FDT manipulation to after the invocation of ExitBootServices(). Given that the stub's libfdt implementation uses the ordinary, accelerated string functions, which rely on hardware handling of unaligned accesses, manipulating the FDT with the MMU off may result in alignment faults. So fix the situation by moving the update_fdt_memmap() call into the callback function invoked by efi_exit_boot_services() right before it calls the ExitBootServices() UEFI service (which is arguably a better place for it anyway) Note that disabling the MMU in ExitBootServices() is not compliant with the UEFI spec, and carries great risk due to the fact that switching from cached to uncached memory accesses halfway through compiler generated code (i.e., involving a stack) can never be done in a way that is architecturally safe. Fixes: abfb7b686a3e ("efi/libstub/arm*: Pass latest memory map to the kernel") Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Tested-by: Riku Voipio <riku.voipio@linaro.org> Cc: <stable@vger.kernel.org> Cc: mark.rutland@arm.com Cc: linux-efi@vger.kernel.org Cc: matt@codeblueprint.co.uk Cc: leif.lindholm@linaro.org Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/1485971102-23330-2-git-send-email-ard.biesheuvel@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'sound/pci/trident/trident_main.c')