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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA2DDCD5BD7 for ; Thu, 5 Sep 2024 16:26:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0FB046B008A; Thu, 5 Sep 2024 12:26:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0AAF36B008C; Thu, 5 Sep 2024 12:26:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E680E6B0092; Thu, 5 Sep 2024 12:26:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id C5E916B008A for ; Thu, 5 Sep 2024 12:26:06 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 2DB2312080F for ; Thu, 5 Sep 2024 16:26:06 +0000 (UTC) X-FDA: 82531211532.01.10C941B Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf02.hostedemail.com (Postfix) with ESMTP id 69A5280011 for ; Thu, 5 Sep 2024 16:26:04 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=zx2c4.com header.s=20210105 header.b=OfohRmW0; spf=pass (imf02.hostedemail.com: domain of "SRS0=ehJl=QD=zx2c4.com=Jason@kernel.org" designates 139.178.84.217 as permitted sender) smtp.mailfrom="SRS0=ehJl=QD=zx2c4.com=Jason@kernel.org"; dmarc=pass (policy=quarantine) header.from=zx2c4.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725553487; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Do5c7CrlVBzR36eawPZjFAYUfW38c/yV0aaPlAdI/7A=; b=Ww1FR8goWjk16PGdFiZOwkXLblFZ/FDk7UaM+ucJLJQmrMO77aiUpkA2OM83h1s7IIt7gk ZVCsrm9+S8TyMKoIJzLz2AsT7UIkKj6UHXvgJ9kEh77+eXz+44b24AFozJ5frnKkgGH2bq re9XO8hhkOfc62YwGKl6ovvUrgErm5A= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=zx2c4.com header.s=20210105 header.b=OfohRmW0; spf=pass (imf02.hostedemail.com: domain of "SRS0=ehJl=QD=zx2c4.com=Jason@kernel.org" designates 139.178.84.217 as permitted sender) smtp.mailfrom="SRS0=ehJl=QD=zx2c4.com=Jason@kernel.org"; dmarc=pass (policy=quarantine) header.from=zx2c4.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725553487; a=rsa-sha256; cv=none; b=Uzx+spVHLNjgsVDrlrDDqcwfjOpMzWmmLjEMcG7GnGO4YDZmusGptj9Ich6ZNJ04I6v9fx ALhPkg5p7IATxu5CGVuBWdyc4nLH/sY4Vu5IsOf7yihlmoNS8Q3S0YzkOjiDALHRLyR38b c9JS9UZvZ1pz3BMAwp5uEqYNGlX/c8Q= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id EB9DA5C5CDD; Thu, 5 Sep 2024 16:25:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 105BDC4CEC3; Thu, 5 Sep 2024 16:26:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1725553559; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Do5c7CrlVBzR36eawPZjFAYUfW38c/yV0aaPlAdI/7A=; b=OfohRmW0WWscsD/JbTMstie8DVPRfEAqdaxZ27+GxqvEjuSGKwxn0kbesvOhuICjN3ybwq 3R0FYa3E+HE9NtOmaumJansW+znH81xpDSD6MPUoeZ+BS+3WOO/H96HFll09YpYrzPMaM8 4Nv4waMmBPxUr5ME5qAf6J0j5YD7U7Y= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id da9a2d0b (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 5 Sep 2024 16:25:59 +0000 (UTC) Date: Thu, 5 Sep 2024 18:25:55 +0200 From: "Jason A. Donenfeld" To: Christophe Leroy Cc: Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Michael Ellerman , Nicholas Piggin , Naveen N Rao , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Shuah Khan , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kselftest@vger.kernel.org, llvm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, Adhemerval Zanella , Xi Ruoyao Subject: Re: [PATCH v5 4/5] powerpc/vdso: Wire up getrandom() vDSO implementation on VDSO32 Message-ID: References: <1f49c2ce009f8b007ab0676fb41187b2d54f28b2.1725304404.git.christophe.leroy@csgroup.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Stat-Signature: ypd5cf6kf7jzg3rf3ni6r8q5zqbeb9z5 X-Rspam-User: X-Rspamd-Queue-Id: 69A5280011 X-Rspamd-Server: rspam02 X-HE-Tag: 1725553564-816650 X-HE-Meta: U2FsdGVkX1+kopo0Gs+xtfBO5pQWqpBd/2h7q4nxbv6B316XkdQc+RVsUSmi9eXkYJOb1HJO8TFY3MN0VqL7zeWrsmy7McdDzgIXdvbAFIDFnPYW2nynxcRND3A3lR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VjoSlp6rXXgnQZOfRRfh0dG/NQnh6uZ8nFwB/cGzWvAoq2iSkot61Y6bJ5LP9Sh1LtnBaVMP1ods0KbE1WRKkusSg7ZnCns5wKpTTqEXzbJF+gHbG51QslLzSIgSqeuNiDUTC7gWojzGM9S9vbotN3cixak9KxZyj1I/yJfdxW+kpalo8whuCBdldjeHna+U8sQomgfQhOpRdSvpF3t1+dXyByd/XtQqZ/7x66E85/Mg== 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 Thu, Sep 05, 2024 at 06:13:29PM +0200, Jason A. Donenfeld wrote: > > +/* > > + * The macro sets two stack frames, one for the caller and one for the callee > > + * because there are no requirement for the caller to set a stack frame when > > + * calling VDSO so it may have omitted to set one, especially on PPC64 > > + */ > > + > > +.macro cvdso_call funct > > + .cfi_startproc > > + PPC_STLU r1, -PPC_MIN_STKFRM(r1) > > + .cfi_adjust_cfa_offset PPC_MIN_STKFRM > > + mflr r0 > > + PPC_STLU r1, -PPC_MIN_STKFRM(r1) > > + .cfi_adjust_cfa_offset PPC_MIN_STKFRM > > + PPC_STL r0, PPC_MIN_STKFRM + PPC_LR_STKOFF(r1) > > + .cfi_rel_offset lr, PPC_MIN_STKFRM + PPC_LR_STKOFF > > + get_datapage r8 > > + addi r8, r8, VDSO_RNG_DATA_OFFSET > > + bl CFUNC(DOTSYM(\funct)) > > + PPC_LL r0, PPC_MIN_STKFRM + PPC_LR_STKOFF(r1) > > + cmpwi r3, 0 > > + mtlr r0 > > + addi r1, r1, 2 * PPC_MIN_STKFRM > > + .cfi_restore lr > > + .cfi_def_cfa_offset 0 > > + crclr so > > + bgelr+ > > + crset so > > + neg r3, r3 > > + blr > > + .cfi_endproc > > +.endm > > You wrote in an earlier email that this worked with time namespaces, but > in my testing that doesn't seem to be the case. > > From my test harness [1]: > > Normal single thread > vdso: 25000000 times in 12.494133131 seconds > libc: 25000000 times in 69.594625188 seconds > syscall: 25000000 times in 67.349243972 seconds > Time namespace single thread > vdso: 25000000 times in 71.673057436 seconds > libc: 25000000 times in 71.712774121 seconds > syscall: 25000000 times in 66.902318080 seconds > > I'm seeing this on ppc, ppc64, and ppc64le. > > Can you figure out what's going on and send a fix, which I'll squash > into this commit? Also, FYI, I've verified that things do work on x86_64, loongarch64, arm64, and arm64_be. It's just the ppc archs that are broken. So this test _is_ a good one.