Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4684587ybg; Tue, 29 Oct 2019 10:50:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqwrmADu/UCtjPrCq/PXfZsdX0VyG/PEQhs6HpYucJpvdimMj8CjRUJSgAZU1idIDlgBn/nf X-Received: by 2002:a17:906:d781:: with SMTP id pj1mr4517132ejb.98.1572371437460; Tue, 29 Oct 2019 10:50:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572371437; cv=none; d=google.com; s=arc-20160816; b=snefOclP8784YZ+O3XNAfKgmNyoPzxCkbHcZ4MVH0+RxYFDWW1ogi8AbZL1cY3TsH/ qCG4WTHC7iqdnkzcfwehSC/jIDXJZ7z81fxGJ3u1+WiPKPX/gXeRW7jjayL4oZZfq1MT VRkjdvhPB1KCmiTKW5rVDU0G5WxCzMl80L27OH603RGGy3F0+XBdPjkmwflwn6bnXWnR V2HJ0bZ88C3OAMPJc+PUSMgPqDJDPFvinhVAExcVcu2pRbir+ZQZbHD4+g49etzi+zXE mQFVjVm6VzZQV2/0lnAI5LIolIlhmzJA42U3plOxhoNtEjLnbOCo5jm3lEoDZH9D6Vh+ 71wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:references :in-reply-to:message-id:dkim-signature; bh=908ictPM0d9tdAvkWhNTctaYRgZOsXF5jkHRnAfr4Tk=; b=sVn0AVaRI4pxkI+ETeQKElGu5iKlDkJT5HIxjt1+x5lnvGYP5EQgnKMGwczWv/q76l 0TCyAGc+BuLIY7YmGSX2MWvV6oQHmhKRinBJNFauWE4J9H6+7QhHpm//W7kAc0m/fJnx kwUuYy9M+18B+ghrL7roGrB3Q1d7M9eCOaNQ5qwgRO8MNXe4f069Mj6bdHIV0mgIf3l1 9p5SgOGz8ekhbMUUdUsCT1HPnvv5FslBUJEql7BZkwMIDpYi2AubQA4sPdZRGL2D9RFN 1EHP+VKetf57F9hjLMAAiqyJI0ISypXMqWnH6akFmHXiLujZYDgRdj0FnZyUnzHctHBf 6f4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=o6bKkRdW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g5si1279576ejp.406.2019.10.29.10.50.14; Tue, 29 Oct 2019 10:50:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=o6bKkRdW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733269AbfJ2JxU (ORCPT + 99 others); Tue, 29 Oct 2019 05:53:20 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:43768 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733132AbfJ2JxI (ORCPT ); Tue, 29 Oct 2019 05:53:08 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 472RjF6NJ7z9tyh4; Tue, 29 Oct 2019 10:53:05 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=o6bKkRdW; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id YsSxrvHZJzKT; Tue, 29 Oct 2019 10:53:05 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 472RjF50Xjz9tygy; Tue, 29 Oct 2019 10:53:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1572342785; bh=908ictPM0d9tdAvkWhNTctaYRgZOsXF5jkHRnAfr4Tk=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=o6bKkRdWC2f3BZfgPqKFQ72tp5AFMwo90bzpBHyN0WcUD2TZsSCelHf7bFCO5+8PR 5FTSU2EfX8U/sPqoCbI0twKJ0Lsg48aA9e/hfHFdSkFwuLwm41YLdDFu9zgCnXgCJK VDwjAjEGscxE0O8sSnQFvdNZECNAiu/bcVfMgnXA= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id BD6FE8B84C; Tue, 29 Oct 2019 10:53:06 +0100 (CET) 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 DcDmVFPF9K4a; Tue, 29 Oct 2019 10:53:06 +0100 (CET) Received: from localhost.localdomain (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 89DAB8B755; Tue, 29 Oct 2019 10:53:06 +0100 (CET) Received: by localhost.localdomain (Postfix, from userid 0) id 558646B6FD; Tue, 29 Oct 2019 09:53:06 +0000 (UTC) Message-Id: <85cc56b1cd337e3d9673286a0b14c23ebdfbae7a.1572342582.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v3 1/8] powerpc/32: Add VDSO version of getcpu on non SMP To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Tue, 29 Oct 2019 09:53:06 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 18ad51dd342a ("powerpc: Add VDSO version of getcpu") added getcpu() for PPC64 only, by making use of a user readable general purpose SPR. PPC32 doesn't have any such SPR. For non SMP, just return CPU id 0 from the VDSO directly. PPC32 doesn't support CONFIG_NUMA so NUMA node is always 0. Before the patch, vdsotest reported: getcpu: syscall: 1572 nsec/call getcpu: libc: 1787 nsec/call getcpu: vdso: not tested Now, vdsotest reports: getcpu: syscall: 1582 nsec/call getcpu: libc: 502 nsec/call getcpu: vdso: 187 nsec/call Signed-off-by: Christophe Leroy --- v2: fixed build error in getcpu.S v3: dropped the fast system call, only support non SMP for now. --- arch/powerpc/kernel/vdso32/Makefile | 4 +--- arch/powerpc/kernel/vdso32/getcpu.S | 17 +++++++++++++++++ arch/powerpc/kernel/vdso32/vdso32.lds.S | 2 +- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kernel/vdso32/Makefile b/arch/powerpc/kernel/vdso32/Makefile index 06f54d947057..e147bbdc12cd 100644 --- a/arch/powerpc/kernel/vdso32/Makefile +++ b/arch/powerpc/kernel/vdso32/Makefile @@ -2,9 +2,7 @@ # List of files in the vdso, has to be asm only for now -obj-vdso32-$(CONFIG_PPC64) = getcpu.o -obj-vdso32 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o \ - $(obj-vdso32-y) +obj-vdso32 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o getcpu.o # Build rules diff --git a/arch/powerpc/kernel/vdso32/getcpu.S b/arch/powerpc/kernel/vdso32/getcpu.S index 63e914539e1a..90b39af14383 100644 --- a/arch/powerpc/kernel/vdso32/getcpu.S +++ b/arch/powerpc/kernel/vdso32/getcpu.S @@ -15,6 +15,7 @@ * int __kernel_getcpu(unsigned *cpu, unsigned *node); * */ +#if defined(CONFIG_PPC64) V_FUNCTION_BEGIN(__kernel_getcpu) .cfi_startproc mfspr r5,SPRN_SPRG_VDSO_READ @@ -31,3 +32,19 @@ V_FUNCTION_BEGIN(__kernel_getcpu) blr .cfi_endproc V_FUNCTION_END(__kernel_getcpu) +#elif !defined(CONFIG_SMP) +V_FUNCTION_BEGIN(__kernel_getcpu) + .cfi_startproc + cmpwi cr0, r3, 0 + cmpwi cr1, r4, 0 + li r5, 0 + beq cr0, 1f + stw r5, 0(r3) +1: li r3, 0 /* always success */ + crclr cr0*4+so + beqlr cr1 + stw r5, 0(r4) + blr + .cfi_endproc +V_FUNCTION_END(__kernel_getcpu) +#endif diff --git a/arch/powerpc/kernel/vdso32/vdso32.lds.S b/arch/powerpc/kernel/vdso32/vdso32.lds.S index 00c025ba4a92..5206c2eb2a1d 100644 --- a/arch/powerpc/kernel/vdso32/vdso32.lds.S +++ b/arch/powerpc/kernel/vdso32/vdso32.lds.S @@ -155,7 +155,7 @@ VERSION __kernel_sync_dicache_p5; __kernel_sigtramp32; __kernel_sigtramp_rt32; -#ifdef CONFIG_PPC64 +#if defined(CONFIG_PPC64) || !defined(CONFIG_SMP) __kernel_getcpu; #endif -- 2.13.3