Return-Path: Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40sjRH5GRxzF1n3 for ; Fri, 25 May 2018 20:39:07 +1000 (AEST) From: Michael Ellerman To: "Naveen N. Rao" Cc: linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v2 2/2] selftests/powerpc: Add test to verify rfi flush across a system call In-Reply-To: <1527185167.d6rdwm7ol7.naveen@linux.ibm.com> References: <5777d4ff6a9216b189f349f98217d47b38278661.1526915409.git.naveen.n.rao@linux.vnet.ibm.com> <87r2m142ci.fsf@concordia.ellerman.id.au> <1527185167.d6rdwm7ol7.naveen@linux.ibm.com> Date: Fri, 25 May 2018 20:39:06 +1000 Message-ID: <87k1rsqat1.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , "Naveen N. Rao" writes: > Michael Ellerman wrote: >> "Naveen N. Rao" writes: >>> diff --git a/tools/testing/selftests/powerpc/security/rfi_flush.c b/tools/testing/selftests/powerpc/security/rfi_flush.c >>> new file mode 100644 >>> index 000000000000..a20fe8eca161 >>> --- /dev/null >>> +++ b/tools/testing/selftests/powerpc/security/rfi_flush.c >>> @@ -0,0 +1,132 @@ >> ... >>> + >>> +int rfi_flush_test(void) >>> +{ >>> + char *p; >>> + int repetitions = 10; >>> + int fd, passes = 0, iter, rc = 0; >>> + struct perf_event_read v; >>> + uint64_t l1d_misses_total = 0; >>> + unsigned long iterations = 100000, zero_size = 24*1024; >>> + int rfi_flush_org, rfi_flush; >>> + >>> + SKIP_IF(geteuid() != 0); >>> + >>> + if (read_debugfs_file("powerpc/rfi_flush", &rfi_flush_org)) { >>> + perror("error reading powerpc/rfi_flush debugfs file"); >>> + printf("unable to determine current rfi_flush setting"); >>> + return 1; >>> + } >> >> This leads to a hard error on old kernels, which I don't want (breaks my CI). > > Hmm... didn't realize new tests would be run on older kernels. Are those > older stable/distro releases, or actually just earlier kernel versions? All of the above :) Obviously keeping all the tests working across all kernel versions ever is impossible, but when it's relatively easy like in this case, it's nice to do. So that was mostly just an FYI, I don't expect test writers to get their tests running across all kernel versions. cheers