From patchwork Thu Aug 22 07:13:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13772840 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7DF6C531DF for ; Thu, 22 Aug 2024 07:15:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 63D236B00CE; Thu, 22 Aug 2024 03:15:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5C5D86B028E; Thu, 22 Aug 2024 03:15:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 39E6480012; Thu, 22 Aug 2024 03:15:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 0532C6B00A5 for ; Thu, 22 Aug 2024 03:15:05 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id AC510C1312 for ; Thu, 22 Aug 2024 07:15:05 +0000 (UTC) X-FDA: 82479019770.07.E8E30E8 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf14.hostedemail.com (Postfix) with ESMTP id 621A9100013 for ; Thu, 22 Aug 2024 07:15:03 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724310796; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MBHjqvqS12fvfjM8mveRKfh8AAQohzBoDZ0PbKlPNL8=; b=ccih+jSbFBNu1dVwhqqhfYFgvwXxkFlk5mkYAh3aL4/hL4RnO51EaXdL1vEW6OiU2Rd9aA 67NYGrC1ne5/REnaPbWxu64gp3IPBYHa1gqmtaaCwRrgwtS+ZShPA/pVCskexgnXFMgtLf w18bhu4o/7aUEvgZVscbNBCULBE2fxs= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724310796; a=rsa-sha256; cv=none; b=n9irBdU40D22F6yIPg4nekAqG6rLi6/ljeonoOEfHdGGsU4OAbyVdWplbpg45TBXGIffXi wLqxs9apCljzG60JZMJ79tmq4NCZWkNu8L/e9BQqiENF74saTia/JtRT6n7wRQa7Iyl4Yc JFsKmsqy+rHN9Jnpo84ovTv1WbElMFA= Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WqDvR5CX1z9sT8; Thu, 22 Aug 2024 09:13:39 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 21DgOl8Lk8Ri; Thu, 22 Aug 2024 09:13:39 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WqDvR4LvYz9sSy; Thu, 22 Aug 2024 09:13:39 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 83ED38B77E; Thu, 22 Aug 2024 09:13:39 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id WGcMRiOmQSwe; Thu, 22 Aug 2024 09:13:39 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (PO16920.IDSI0.si.c-s.fr [192.168.232.181]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 6F6158B763; Thu, 22 Aug 2024 09:13:38 +0200 (CEST) From: Christophe Leroy To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Theodore Ts'o" , "Jason A. Donenfeld" , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Vincenzo Frascino , Shuah Khan Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 16/17] selftests: vdso: Make VDSO function call more generic Date: Thu, 22 Aug 2024 09:13:24 +0200 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724310795; l=2025; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=Rn9d/ML2os7fiyWcUOGlavHd5OPzN/t1RfDUsN+0Qrg=; b=4ocv1Gynupmkdok/Yucd3J51RkIKkwAAgn+EGWRtuZhZI5J46ZOVIQ7c0ay2qC0zGA01fJtbr LHl2STYwXzSBtCp1j1FM7keZHQwVVi86v7ufMShJDfdkWwIamam+Wbi X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 621A9100013 X-Stat-Signature: hap8kwdo5tczgezfp3meagy7apuipgjr X-Rspam-User: X-HE-Tag: 1724310903-655639 X-HE-Meta: U2FsdGVkX18l45vTUzKE00hjSUCbOTGO9Qu9EpIiEm385P2z3aHmzWhYrc7xUR0ZglCEfiwesONRoFsUEx6VJllCzN2SSHPTY8w2IhleKjFXq3PVMvKkFNITt1lWy1JaFflv4RlKZQsNpUgbSDR7y2QupbEsDQs62BsNOJq58MThv3vwgGA4sqFAPikgN3O2ClCgD/ByedFzJp/pkmNBXIcZkrFu7oS3CObhxrnMkuwELEYlXnxaDdpwQ2CXnVJjqsDzF9V5uzNOLsd4cFHKdcDZv+RAiN/66tUbevfBkboqMfK05MR33ec3PtaA0dmItMySwfsqMtFdLzzdtdfKg5vCauPWH/AFOKsRqhvok/YBlrgbCq1vhmH5UZ38ftN7+v2zYdprwwTvuHqPeSZdXwp3JihkzeKONQ8Y3YUfWKLvgl1XzHGRTAmJiUCGZxIhjm48mCEC+EWgMi8X4X1UfHObFQdSoo5eMx+ctJrUcNlKB6LBT4jMVId0BY88pNA6z6TjMDgJ3iEK1c98wq2sDhEX0xeDbmxkz12rlUYkH1KI4iZEYAmdra3uabF58iwxFEqN21G1bzRes8g6kifspnh5NBi9lhOCji8otH7NadCte8gvbAcKZ2XF/z8Zg4Cm6AfLNwMgWx7T5h7u3GpzAXv0XAb5DfhUeerbPCXVM4nemUoxmLRffKyfZnw3SrotkalCZCLy/etRro8PQZdEBxzPse1m6iL41xw0i67OYV3wpTsze0p6tgfs0+jkFmk11duYIMryhM9e7A9LNCDnvo5+0/RmHE+gNhMD5wSuWDiCv9ffcLbGlCUfs7jtS76l6r1DSA2bGuuI6sMe8ml1efvepOnceVragqqXPDcHfjO8gMb7hsxnLA/3tQqew38yruz0VB0+2O84lzxFmy+klJyvUUhXxYnJDaAD5TrFz64QNRn3vwwlQHf28im+rbrfNZdyDqJ/5DvQATj6QRF lfQX30JU LR0rdERDqDV/CVug+bbd3tQh+vGFwA2iZzWkQuigDidahNo8l9USGFrQFPLk1VySs9n0Ou8MhrmHO/+sYM1/rH89vatYyKy6jKG2CRes6+LK4QaVkxOuPf9R6+Bi/jC2Cdaz1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On powerpc, a call to a VDSO function is not a standard C function call. Unlike x86 that returns a negated error code in case of an error, powerpc sets CR[SO] and returns the error code as a positive value. So use a macro called VDSO_CALL() which takes a pointer to the function to call, the number of arguments and the arguments. Signed-off-by: Christophe Leroy --- tools/testing/selftests/vDSO/vdso_call.h | 12 ++++++++++++ tools/testing/selftests/vDSO/vdso_test_getrandom.c | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/vDSO/vdso_call.h diff --git a/tools/testing/selftests/vDSO/vdso_call.h b/tools/testing/selftests/vDSO/vdso_call.h new file mode 100644 index 000000000000..ca5db2220925 --- /dev/null +++ b/tools/testing/selftests/vDSO/vdso_call.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Macro to call vDSO functions + * + * Copyright (C) 2024 Christophe Leroy , CS GROUP France + */ +#ifndef __VDSO_CALL_H__ +#define __VDSO_CALL_H__ + +#define VDSO_CALL(fn, nr, args...) fn(args) + +#endif diff --git a/tools/testing/selftests/vDSO/vdso_test_getrandom.c b/tools/testing/selftests/vDSO/vdso_test_getrandom.c index 02bcffc23e0c..16ad400721c3 100644 --- a/tools/testing/selftests/vDSO/vdso_test_getrandom.c +++ b/tools/testing/selftests/vDSO/vdso_test_getrandom.c @@ -22,6 +22,7 @@ #include "../kselftest.h" #include "parse_vdso.h" #include "vdso_config.h" +#include "vdso_call.h" #ifndef timespecsub #define timespecsub(tsp, usp, vsp) \ @@ -147,7 +148,7 @@ static ssize_t vgetrandom(void *buf, size_t len, unsigned long flags) exit(KSFT_FAIL); } } - return grnd_ctx.fn(buf, len, flags, state, grnd_ctx.params.size_of_opaque_state); + return VDSO_CALL(grnd_ctx.fn, 5, buf, len, flags, state, grnd_ctx.params.size_of_opaque_state); } enum { TRIALS = 25000000, THREADS = 256 };