Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4472098ybb; Tue, 7 Apr 2020 08:09:28 -0700 (PDT) X-Google-Smtp-Source: APiQypJfcZLUmgNZuT7duVWw9VFMXpWMQgUeG2OI2lthnglPm2wosBH1cVFw3Zbr4+T4l+1+POV9 X-Received: by 2002:a05:6808:2c7:: with SMTP id a7mr2135257oid.149.1586272168373; Tue, 07 Apr 2020 08:09:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586272168; cv=none; d=google.com; s=arc-20160816; b=E5q7VxiJOzkGrYYl5PcKR1OFjb0xwNLDI1aDp99DQCpfVmBe/R9BdAfI6MkQrJTGXH mS8JFzy2lQrB+RyrVKy96TnmQKvsNUYxWK6Icw2q6BbD0Lmjb1GUYy6OugbyQLRjEt5e 5Et5HBR8NXUo2ap9gTN8byg2aQBBgJ8Cfb5oyWD0HmsWyTY72T/NiTEKVLHTFmZyRD/p Ms0Aiqa+nDYCeAsUGXbTd74XLiGpV2HzMcM74LZU6El2cbflBHWrzamzHhJhYBpFCS+I b+0pqaDYeY/Ia3u/hREhaLGMFcjdpt8K0Yc/PUMgZ9MCE3xTkl9ejaHnfspTD1BbBVc5 1A9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :user-agent:mime-version:in-reply-to:references:cc:to:subject:from :date; bh=oK3DRhtKcqXHdnsTGUDZ1Q/0PQtn4PnOoTtMFtxkzX8=; b=xAAzhACEOIi5uYLLucEbp9h5jyNZhdmRH+PqVZOaKRMKsoB7RbmnGd2iTPuCVRLZvs tNQDxYaHFcZVAZybAOdhqe+HbnCNQSDK4hAbysOnVXaaqtyfVz0oR9agRtP7nejuRQFR IvXfJaIg1FDYXnEGR+iTw3EoB50H2378wu3xzZN0u6oJPCBNN+talENvs89R133usEqn Ah+MWwQUe91ahWk9prbYwuFVes82JPy3gO7+908DrzpGPgocWV3kAd0CfmACSwzcDlr1 7cPUJbmfHtkDWXsR5+IRKiZDT6IL5HCGn/9BlCSoKIUKZgFWtQFtz9CSaCgkIRHTUT+q iZew== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z5si1308299otm.267.2020.04.07.08.09.12; Tue, 07 Apr 2020 08:09:28 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729237AbgDGPI0 convert rfc822-to-8bit (ORCPT + 99 others); Tue, 7 Apr 2020 11:08:26 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:51630 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728917AbgDGPI0 (ORCPT ); Tue, 7 Apr 2020 11:08:26 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 037F82rh066732 for ; Tue, 7 Apr 2020 11:08:25 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 3082pej4nf-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 07 Apr 2020 11:08:24 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 7 Apr 2020 16:08:04 +0100 Received: from b06avi18626390.portsmouth.uk.ibm.com (9.149.26.192) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 7 Apr 2020 16:08:00 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 037F7Djk48431584 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 7 Apr 2020 15:07:13 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D721A4C04A; Tue, 7 Apr 2020 15:08:17 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 72EAE4C044; Tue, 7 Apr 2020 15:08:17 +0000 (GMT) Received: from localhost (unknown [9.85.74.108]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 7 Apr 2020 15:08:17 +0000 (GMT) Date: Tue, 07 Apr 2020 20:38:13 +0530 From: "Naveen N. Rao" Subject: Re: [PATCH v6 4/4] powerpc/vdso: Switch VDSO to generic C implementation. To: Benjamin Herrenschmidt , Christophe Leroy , Michael Ellerman , nathanl@linux.ibm.com, Paul Mackerras Cc: arnd@arndb.de, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, luto@kernel.org, tglx@linutronix.de, vincenzo.frascino@arm.com References: <56e0cc4bc8314ee4da87256fcafc03885977f0dd.1586265010.git.christophe.leroy@c-s.fr> In-Reply-To: <56e0cc4bc8314ee4da87256fcafc03885977f0dd.1586265010.git.christophe.leroy@c-s.fr> MIME-Version: 1.0 User-Agent: astroid/v0.15-13-gb675b421 (https://github.com/astroidmail/astroid) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8BIT X-TM-AS-GCONF: 00 x-cbid: 20040715-0008-0000-0000-0000036C3AB7 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20040715-0009-0000-0000-00004A8DD4DB Message-Id: <1586271940.xja63xxjer.naveen@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.676 definitions=2020-04-07_07:2020-04-07,2020-04-07 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 clxscore=1015 spamscore=0 lowpriorityscore=0 malwarescore=0 phishscore=0 adultscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004070127 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Christophe Leroy wrote: > powerpc is a bit special for VDSO as well as system calls in the > way that it requires setting CR SO bit which cannot be done in C. > Therefore, entry/exit needs to be performed in ASM. > > Implementing __arch_get_vdso_data() would clobbers the link register, > requiring the caller to save it. As the ASM calling function already > has to set a stack frame and saves the link register before calling > the C vdso function, retriving the vdso data pointer there is lighter. > > Implement __arch_vdso_capable() and: > - When the timebase is used, make it always return true. > - When the RTC clock is used, make it always return false. > > > Signed-off-by: Christophe Leroy > --- > v6: > - Added missing prototypes in asm/vdso/gettimeofday.h for __c_kernel_ functions. > - Using STACK_FRAME_OVERHEAD instead of INT_FRAME_SIZE > - Rebased on powerpc/merge as of 7 Apr 2020 > - Fixed build failure with gcc 9 > - Added a patch to create asm/vdso/processor.h and more cpu_relax() in it > --- > arch/powerpc/Kconfig | 2 + > arch/powerpc/include/asm/clocksource.h | 7 + > arch/powerpc/include/asm/vdso/clocksource.h | 7 + > arch/powerpc/include/asm/vdso/gettimeofday.h | 175 +++++++++++ > arch/powerpc/include/asm/vdso/vsyscall.h | 25 ++ > arch/powerpc/include/asm/vdso_datapage.h | 40 +-- > arch/powerpc/kernel/asm-offsets.c | 49 +--- > arch/powerpc/kernel/time.c | 91 +----- > arch/powerpc/kernel/vdso.c | 5 +- > arch/powerpc/kernel/vdso32/Makefile | 32 +- > arch/powerpc/kernel/vdso32/config-fake32.h | 34 +++ > arch/powerpc/kernel/vdso32/gettimeofday.S | 291 +------------------ > arch/powerpc/kernel/vdso32/vgettimeofday.c | 29 ++ > arch/powerpc/kernel/vdso64/Makefile | 23 +- > arch/powerpc/kernel/vdso64/gettimeofday.S | 243 +--------------- > arch/powerpc/kernel/vdso64/vgettimeofday.c | 29 ++ > 16 files changed, 391 insertions(+), 691 deletions(-) > create mode 100644 arch/powerpc/include/asm/clocksource.h > create mode 100644 arch/powerpc/include/asm/vdso/clocksource.h > create mode 100644 arch/powerpc/include/asm/vdso/gettimeofday.h > create mode 100644 arch/powerpc/include/asm/vdso/vsyscall.h > create mode 100644 arch/powerpc/kernel/vdso32/config-fake32.h > create mode 100644 arch/powerpc/kernel/vdso32/vgettimeofday.c > create mode 100644 arch/powerpc/kernel/vdso64/vgettimeofday.c You should also consider adding -fasynchronous-unwind-tables. For background, please see: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ba96301ce9be7925cdaee677b1a2ff8eddba9fd4 - Naveen