From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4869C433E6 for ; Mon, 31 Aug 2020 21:48:39 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 956302083E for ; Mon, 31 Aug 2020 21:48:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ch6PSMzw"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="PHJwMJHi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 956302083E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vXqJFlctZc4h6FzjmuJMTWwMTf4kSWKo/Do8ESUELjk=; b=ch6PSMzwZ3oepP4QyUmvOZ+Gp QnkeTQM63dDbI/BR/Dreb4PSCMjI891rUrmXjfYIGzeftT7a1Sn8vplGy36tactgrtCOw4a3q13p4 q9I9vbwFEpqaqQOshp0bYQ2IU+4pFP5qisWUHcS7xWdIIB+c3FwyMMwfudt9i3PnjTxAevhcaHn72 TXp8llrT6OQIZjEIWEM5Xw5Yi49NT8c0uWUj//kf07jRL+PSMZwiLHSOr5ny9MXsnv80rfBECCac/ 19Ohyqn3Yqb/6E+HPzUVFGOZuuDYUfnfJEitRZXLruWYwkiKBe5QAjkNnF54w/D4tY7iL1XSG8c3U RcNAqJCVg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kCre7-0002m5-0n; Mon, 31 Aug 2020 21:47:23 +0000 Received: from mail-il1-x142.google.com ([2607:f8b0:4864:20::142]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kCre3-0002lH-QB for linux-arm-kernel@lists.infradead.org; Mon, 31 Aug 2020 21:47:20 +0000 Received: by mail-il1-x142.google.com with SMTP id t13so2508736ile.9 for ; Mon, 31 Aug 2020 14:47:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=qvz/CMJG9nHfpZS80MxVIQpGJna6lnztPKG1hZSN3NY=; b=PHJwMJHijFYAekG54vhbkWa4+b3SegE+3IJp4IP903Ke7WI6w5X4CgzSA1cl0PMOBi 0FcF9Y1W9dCjqBc7R/KUaD+tNiJ+GDLBlumv8c5TL15KqyDckJQPVtZ3tPuJs1WkgX5y JFI0HxEOFV9gtQTG35V7TyI5aTywUiBwNK4fo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=qvz/CMJG9nHfpZS80MxVIQpGJna6lnztPKG1hZSN3NY=; b=Mnyy4/nCv5r+lP89RGg/7Y1+oCcawUeQM6Q9WiZq+L9M/ewUapp0jkkjMLoZC7U47E fy7h60izA1O7CMkeMhEu94lncwYKk7ypEi5Mfiu0QMLSBmaKSti47aEqp5AeWcgCm6bm NsuON/gnFAxrrLhfZnJ9A+sF3DBjTfAJ9dELj4fT9eI4DlNq7u+EQKt7+7OQWXyk5k/q Jr005fJH0bH31UeoVcpinmgtZafaxOSY7PS+14sfK8Gn32FbRWcnkbc0Zn9gFGpdMF6y fDDoTqfGbCbPt1oLEDkYYWh5mYVjLGS09mtYBI1VonY6OWFY50aqnVIyIPh9i9Vnknzk nC2w== X-Gm-Message-State: AOAM531BHr3bIHiWm/4w9BfDTQ2JFkQgJW90p4V/y4bRIo2zkWShw/ZZ aMB9/q5jOAzOAKFP6Z/VxCr+lOfdTyDLHw== X-Google-Smtp-Source: ABdhPJy1Q3XmzIjTF+EDlFRykZhvKRG/Z3ESnsl75oOdm2JRjF2KzjD/RySQX8tSyvFbiInBiHDJWg== X-Received: by 2002:a92:4f:: with SMTP id 76mr2978653ila.11.1598910438274; Mon, 31 Aug 2020 14:47:18 -0700 (PDT) Received: from [192.168.1.112] (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id i73sm2986454ild.61.2020.08.31.14.47.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 31 Aug 2020 14:47:17 -0700 (PDT) Subject: Re: [PATCH v3 0/5] arm64: vdso: getcpu() support To: Mark Brown , Catalin Marinas , Will Deacon References: <20200819121318.52158-1-broonie@kernel.org> From: Shuah Khan Message-ID: <315d97af-715a-9942-a731-11de2fbbbded@linuxfoundation.org> Date: Mon, 31 Aug 2020 15:47:17 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200819121318.52158-1-broonie@kernel.org> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200831_174719_962801_8AC28F5A X-CRM114-Status: GOOD ( 32.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vincenzo Frascino , Shuah Khan , linux-kselftest@vger.kernel.org, linux-arm-kernel@lists.infradead.org, "skh >> Shuah Khan" Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 8/19/20 6:13 AM, Mark Brown wrote: > Some applications, especially tracing ones, benefit from avoiding the > syscall overhead for getcpu() so it is common for architectures to have > vDSO implementations. Add one for arm64, using TPIDRRO_EL0 to pass a > pointer to per-CPU data rather than just store the immediate value in > order to allow for future extensibility. > > It is questionable if something TPIDRRO_EL0 based is worthwhile at all > on current kernels, since v4.18 we have had support for restartable > sequences which can be used to provide a sched_getcpu() implementation > with generally better performance than the vDSO approach on > architectures which have that[1]. Work is ongoing to implement this for > glibc: > > https://lore.kernel.org/lkml/20200527185130.5604-3-mathieu.desnoyers@efficios.com/ > > but is not yet merged and will need similar work for other userspaces. > The main advantages for the vDSO implementation are the node parameter > (though this is a static mapping to CPU number so could be looked up > separately when processing data if it's needed, it shouldn't need to be > in the hot path) and ease of implementation for users. > > This is currently not compatible with KPTI due to the use of TPIDRRO_EL0 > by the KPTI trampoline, this could be addressed by reinitializing that > system register in the return path but I have found it hard to justify > adding that overhead for all users for something that is essentially a > profiling optimization which is likely to get superceeded by a more > modern implementation - if there are other uses for the per-CPU data > then the balance might change here. > > This builds on work done by Kristina Martsenko some time ago but is a > new implementation. > > [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d7822b1e24f2df5df98c76f0e94a5416349ff759 > > v3: > - Rebase on v5.9-rc1. > - Drop in progress portions of the series. > v2: > - Rebase on v5.8-rc3. > - Add further cleanup patches & a first draft of multi-page support. > > Mark Brown (5): > arm64: vdso: Provide a define when building the vDSO > arm64: vdso: Add per-CPU data > arm64: vdso: Initialise the per-CPU vDSO data > arm64: vdso: Add getcpu() implementation > selftests: vdso: Support arm64 in getcpu() test > > arch/arm64/include/asm/processor.h | 12 +---- > arch/arm64/include/asm/vdso/datapage.h | 54 +++++++++++++++++++ > arch/arm64/kernel/process.c | 26 ++++++++- > arch/arm64/kernel/vdso.c | 33 +++++++++++- > arch/arm64/kernel/vdso/Makefile | 4 +- > arch/arm64/kernel/vdso/vdso.lds.S | 1 + > arch/arm64/kernel/vdso/vgetcpu.c | 48 +++++++++++++++++ > .../testing/selftests/vDSO/vdso_test_getcpu.c | 10 ++++ > 8 files changed, 172 insertions(+), 16 deletions(-) > create mode 100644 arch/arm64/include/asm/vdso/datapage.h > create mode 100644 arch/arm64/kernel/vdso/vgetcpu.c > Patches look good to me from selftests perspective. My acked by for these patches to go through arm64. Acked-by: Shuah Khan If you would like me to take these through kselftest tree, give me your Acks. I can queue these up for 5.10-rc1 thanks, -- Shuah _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel