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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 03240C98324 for ; Sun, 27 Sep 2026 07:02:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=udShBe/9uaXR1UMGoba63o/NQaliL/VHp3oK41VCYcE=; b=qJY0DnpfW62v6E LAUEwZ/gbx3QyuBU+ZU4od8E5yjti2sDgjG9rfd7t+pGqb3tvuCXlYyRsZZAJ+vCfF21DkGPEq6UK bZ0YmzrQFbvipcIlw6VYkI28ntw5dxDw9nP2AorwnLsEY79C5Yz2auLqAefhaVxQMt5DLBmJFib05 7E+nFpAVukMBEqbtZgJ+ZvYFbnLVvXWUcZqdm1GRnqycVuH+zaUZ46v5M+OmcPyW3akace3BBQQ+2 m2MKO9GANkOvzwu1wHtkLvIBPfS1MxXguVkx6InVyw1i2lDMEH8BvRMVlSLN1bsCeNaF76BokbbhI rtzvkWZt3+Xd9tNVe6GA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xAiu9-0000000G5OI-1gt7; Sun, 27 Sep 2026 07:02:33 +0000 Received: from mail-wm2-x10.google.com ([2a00:1450:4864:31::10]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xAiu6-0000000G5NH-2cZm for linux-riscv@lists.infradead.org; Sun, 27 Sep 2026 07:02:32 +0000 Received: by mail-wm2-x10.google.com with SMTP id 5b1f17b1804b1-49ffed768deso2810315e9.1 for ; Sun, 27 Sep 2026 00:02:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790492548; x=1791097348; darn=lists.infradead.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=RJKp/brBpZ8U6kwJIcmM4FiZnVhsdc/GYabd2hj9ep0=; b=sh9xIpS95lfenlEobk6PO5gnn/WyjELws59JQ8FC9HXW8WOVLUmEgFvGRNIrnjy4nc dAL4XkDM5I4OBzO7w6z86qIB+56op+9zT2coUZxXZ4LLcw/GL5Y7uq8jtS3L08/VsNI+ mOySkoJByPRxh7ljPjpJihZ6zeKsONFeWE/ejBCA662s/Hn5/z3edm9TA55JmscyE1de jm4EGcwfAaGkUDu8zr1iU8/vslNnr6RPCVPNPZ6xpm6QZPPCE8/hIfNhPEbeDwSBS4an Qcu6KpUQNCJd8Vsl7kvJ0zjaN1oJ8XC9iMgksXJwqSJiDk4VzeW5R/krFu13dzRsU8m6 zFNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790492548; x=1791097348; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=RJKp/brBpZ8U6kwJIcmM4FiZnVhsdc/GYabd2hj9ep0=; b=q0aWMlH9rXU9icGHJRJ9MVjzQgi4xAORfTC//0ptvEfE0dv+jKaMblCoNFNW7kWWKQ C9WA0Fq5TTIlYTCxkb6j/jAtLFAYCMEU7urJL4DIL3b2j+fGE9Mxsbat9Q+jgdW6U4fu J+XxQgaRRHjj+U4NLf31LOdAqVwdk8IsN//gThZGd2wsP8RNVA/Gsp4h4AL8cHmY3TU0 9TdBF0FHBfKvChCnUWuG5heuBrbzlwr5EFYJ40QrFqeplZJW0UN6GaQG5hjbAtfvqzD+ rWdVPzTxguY+IMikY+bnl2UPmoj/BuqLTsfLAVrwSvfo1CJFJJar8jtTmsRNzu6NPFfm XU9g== X-Forwarded-Encrypted: i=1; AKwUvBzIDXfjmOC8kcN3qucxTnslQaUGgBlOyTvv3UvS/MGqi6aM9oIh6sSx0OBPUY31ZE5qUxdQuTOUHV/IAQ==@lists.infradead.org X-Gm-Message-State: AFuF++kdhxDlv9vTgyglZPyk16zocUd/iz/OtkGntjr4bppa7jMcPWgS zdrEAkA/iWdbfkskYWshL7LIrbekPln72PupkoXbusQEc8P5G6g1XqRl X-Gm-Gg: AYBFou1jy84jypql5+FkphVRABYcZGjfj/D0geWsUp1m4ArpYsOfu3CxPxWb5q6lBBZ lri8cWZ5AgU5kCaegx+jhmdFQqHQypSEQJW70dxB0Ek/gEhOsmo7wnQ5N+hwVq3197SKYnRkjV8 hoT1c5pQfPG2FcTpYjShL0BjcO5L8XVmiVxXi658X5l5MkWE4AxhWnJEfTCntryDgdEJkkU7USk U5ym10HYYEMr6g+k6x0sOmMd4LPzDwFuCOIGBjzkEJg3PmcqWaul0nfRwS7zAJoCzrpyfML+2cD P4ceNE9t6NRX00BiPz0iz9EBCnhVHVvjt/MqGIlP9gWTzimHwbVMpbCqfpVldRWt/pLVgnUkwuB qQDtih505aVvBzp4HKF3Wh3I3QT0esZ9Kc4DQ+YBM/7QiPpoAyujbsF0XFssknFVMWq+fqm22Um apRZF0uJPq3D8nY13zLqfOP7ZV77ct0rxagSP5eHJ9mAA/RRunUEPMBWXOrgVAgFuJU8TeUAqMz SmkKpni/O4IxP1qjAzG/BRFTJ0oGw97cqU/ X-Received: by 2002:a05:600c:1f83:b0:49b:8f5e:51fb with SMTP id 5b1f17b1804b1-49fe66c8087mr175447355e9.3.1790492548064; Sun, 27 Sep 2026 00:02:28 -0700 (PDT) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a0018f0e79sm57015315e9.7.2026.09.27.00.02.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2026 00:02:27 -0700 (PDT) Date: Sun, 27 Sep 2026 08:02:25 +0100 From: David Laight To: "Jason A. Donenfeld" Cc: Nathan Chancellor , Andreas Schwab , Andy Lutomirski , Thomas Gleixner , Theodore Ts'o , Vincenzo Frascino , Nick Desaulniers , Bill Wendling , Justin Stitt , Catalin Marinas , Will Deacon , Mark Rutland , Huacai Chen , WANG Xuerui , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , "Christophe Leroy (CS GROUP)" , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH v2] random: vDSO: Avoid call to memset() when zeroing reserved in __cvdso_getrandom_data() Message-ID: <20260927080225.37534e7c@pumpkin> In-Reply-To: References: <20260925-vdso-getrandom-avoid-memset-llvm-24-v2-1-ce640f872393@kernel.org> <87zex4ic68.fsf@linux-m68k.org> <20260926121927.GA1486962@ax162> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260927_000230_677036_9615A290 X-CRM114-Status: GOOD ( 20.62 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Sat, 26 Sep 2026 14:32:49 +0200 "Jason A. Donenfeld" wrote: > On Sat, Sep 26, 2026 at 01:19:27PM +0100, Nathan Chancellor wrote: > > On Sat, Sep 26, 2026 at 11:39:43AM +0200, Andreas Schwab wrote: > > > On Sep 25 2026, Nathan Chancellor wrote: > > > > > > > +#if __has_builtin(__builtin_memset_inline) > > > > +#define memset_inline(dst, value, size) __builtin_memset_inline(dst, value, size) > > > > +#elif IS_ENABLED(CONFIG_CC_HAS_OPT_INLINE_MEMSET) > > > > +#define memset_inline(dst, value, size) __builtin_memset(dst, value, size) > > > > +#else > > > > +static inline void *memset_inline(void *dst, int value, size_t size) > > > > +{ > > > > + char *d = dst; > > > > + > > > > + while (size--) > > > > + *d++ = value; > > > > + > > > > + return d; > > > > +} > > > > +#endif > > > > + > > > > > > memset actually returns the original pointer, not the incremented one. > > > Nothing uses the return value of memset_inline here, but it is > > > confusing. > > > > Whoops, good catch, I guess my fingers gave up on those last two > > characters :) I will fix this for v3 once there has been some time for > > further review. > > Do we even need to return a value at all? Might as well just make the > function two lines: > > + for (char *d = dst; size--;) > + *d++ = value; Wouldn't it be better to add a barrier() or similar in there to stop the compiler playing unwanted games> David > > (Technically that could even be one, but maybe that sort of golf loses > clarity. Your choice.) > _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv