Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp474093rdb; Thu, 18 Jan 2024 08:56:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IEZfekNaHnLSTeAxL5Zo7p9PSNFho8OU2e1/5cwv+ql/MO8I/AN9e/iaQvGjm9xmpDHTMOz X-Received: by 2002:a05:620a:b19:b0:783:74c3:1397 with SMTP id t25-20020a05620a0b1900b0078374c31397mr1048859qkg.149.1705596972880; Thu, 18 Jan 2024 08:56:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705596972; cv=pass; d=google.com; s=arc-20160816; b=U7ruaExj2QE8aj8wJyj54quY9snhMJR9Z2BoSktkaNyWDXAoZUKHwiXAPe5V5GT9rq q7LKkN/VqDQLBRMe9dvKIT7UFXCB/7B8RImuEtyLruD+cYYJUqEJeBVOn5e8yzqUNj4x +/cpP2Yq4J07zRyajIjfiO6DOy/Zw4CmOk64UmB3DIlbw60y6Ur/S+AINsITlmvDivsT 5MbC1ymUdZj5rqZInB4zAvuyaI8y34kz7S5DBx2PCawj45U4eEgnPw5+ZzBiHQtWGITR GyoGtDlPfpWoz5AaQpHrXO5tEh+gdoAZ/HaRixuXBV3XeLD4hZqsvLVU74nLYmFaaxhX 4KBA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=XJPCDAb9ltFQqcoVJ/tueBDSXJjJuEpDoy69OXy/YM8=; fh=DhjUnA0cerpmN6VGE7JInyW4IzcDocw53u0WKADpjb0=; b=HpKuygz7byPthm+Quefb2yaiIp2yGpZm1qtXGi0meESfjET+vB4QqeNJxhPg6+o3RV bss31CWHGYZtZEpyq/tKBmYohJLadCqOtw64yC7Esa0HvzwAn0jIwa+YK5Fuc8VqCOTB X8Qvo1+ngo1kLiNks8ZdPV/cV56m/CPO8oKMeC2lRO1j0V+62LCK2v1mZCLYVv84wP66 STnEHKFPqKednIAfbVyhJw9wmGSCKnFigGpM6pLFym1BnFhRuE62N0n7qvOvoU61jgXv CDF/EtnUJ1YqUsiVlEymW02ywYTrl6bKOQ0OoOlF/I7BDcJ6YjS/Uv7n642DHXSbC5oy VqUA== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-30376-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30376-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id du45-20020a05620a47ed00b007835b80b398si8791087qkb.655.2024.01.18.08.56.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 08:56:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30376-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-30376-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30376-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9A4741C21B7E for ; Thu, 18 Jan 2024 16:56:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0ED8F2C85E; Thu, 18 Jan 2024 16:56:07 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B95E92576D for ; Thu, 18 Jan 2024 16:56:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705596966; cv=none; b=JrNbyQe2zJ2J1t1UdzjEkiNYZkr7/Dayt5doAEysBrBFeHmhXuq3Wx2migO/gRAUSK2gwp7u2Vkz7ehbcGLhsC/1y1Vs44cBE3GlmJAFPjz0/6fkBzA/Cfkk5wEq1uidDS3jjDylYu0CRT461ZiK4TJwibIKfpGnyKx59V36+go= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705596966; c=relaxed/simple; bh=nHGH1MAxtPuNGs+pqDYaFl/U2EYOI3Z+/QVLpFkrnTI=; h=Received:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer: MIME-Version:Content-Transfer-Encoding:X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From:X-SA-Exim-Scanned:X-PTX-Original-Recipient; b=gSiygUfnfgBzYG4o+dlsy3ZWqHaPHkzdgru6Xtw9Fe55DWsKbv1NOMshe+xsX9u52bjNj9aWdENoafPzA+/cB+iThbDwy+5XMq7aBX4bx3/MJzYL2itq8zoG93XyjhQ971Q2VOvAqKF4m5vj3DakABoAqlJx9/PthtsPN3vtixo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rQVgE-0004xK-0X; Thu, 18 Jan 2024 17:55:50 +0100 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1rQVgD-000jWU-Cr; Thu, 18 Jan 2024 17:55:49 +0100 From: Lucas Stach To: Russell King Cc: Ard Biesheuvel , Linus Walleij , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, patchwork-lst@pengutronix.de Subject: [PATCH RFC] ARM: VDSO: don't drop clock_gettime when architected timer isn't available Date: Thu, 18 Jan 2024 17:55:49 +0100 Message-Id: <20240118165549.1935000-1-l.stach@pengutronix.de> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Dropping the clock_gettime entry points when the architected timer is not available is done to gain some efficiency, as it allows libc to fall back to the syscall without dispatching through the vDSO. The difference on a i.MX6 system using the vdso test utility [1] looks like this: $ vdsotest clock-gettime-monotonic bench -d 10 w/o vDSO entrypoint with vDSO entrypoint syscall: 987 nsec/call 974 nsec/call libc: 1095 nsec/call 1148 nsec/call vdso: not available not available Going through libc adds a ~100ns penalty compared to calling the syscall directly. Dispatching through the vDSO adds another ~50ns, which isn't negligible, but also not huge. The downside of dropping the entry points is that now also the COARSE versions of the clocks have to go through the syscall, while they can be accelerated through the vDSO even without the architected timer when the entry points are kept. $ vdsotest clock-gettime-monotonic-coarse bench -d 10 w/o vDSO entrypoint with vDSO entrypoint syscall: 659 nsec/call 662 nsec/call libc: 772 nsec/call 137 nsec/call vdso: not available 63 nsec/call This is quite a nice speedup, but arguably coarse clocks are also not as widely used as the high-res versions. Still, this patch proposes to to take the hit on his-res clocks by dispatching through the vDSO to gain the ability to accelerate coarse clocks. [1] https://github.com/nlynch-mentor/vdsotest Signed-off-by: Lucas Stach --- arch/arm/kernel/vdso.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/arch/arm/kernel/vdso.c b/arch/arm/kernel/vdso.c index f297d66a8a76..947f3d8144fc 100644 --- a/arch/arm/kernel/vdso.c +++ b/arch/arm/kernel/vdso.c @@ -172,11 +172,8 @@ static void __init patch_vdso(void *ehdr) * want programs to incur the slight additional overhead of * dispatching through the VDSO only to fall back to syscalls. */ - if (!cntvct_ok) { + if (!cntvct_ok) vdso_nullpatch_one(&einfo, "__vdso_gettimeofday"); - vdso_nullpatch_one(&einfo, "__vdso_clock_gettime"); - vdso_nullpatch_one(&einfo, "__vdso_clock_gettime64"); - } } static int __init vdso_init(void) -- 2.43.0