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 C3833C433EF for ; Tue, 24 May 2022 17:31:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4FE4E8D0003; Tue, 24 May 2022 13:31:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4AD138D0002; Tue, 24 May 2022 13:31:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3735F8D0003; Tue, 24 May 2022 13:31:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 21B728D0002 for ; Tue, 24 May 2022 13:31:13 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id E92B56061E for ; Tue, 24 May 2022 17:31:12 +0000 (UTC) X-FDA: 79501327584.07.2F2E78C Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by imf20.hostedemail.com (Postfix) with ESMTP id 77FB01C0022 for ; Tue, 24 May 2022 17:30:49 +0000 (UTC) Received: from zn.tnic (p200300ea974657c6329c23fffea6a903.dip0.t-ipconnect.de [IPv6:2003:ea:9746:57c6:329c:23ff:fea6:a903]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id EF15F1EC0575; Tue, 24 May 2022 19:30:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1653413448; 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: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=pFQzpaguKn2mw/j/BFZbpHvd9rTOTeSw8JSaYmA89ps=; b=k3eaDOkk+lic2WnoLwZaWoGj6rQtfhwSKTGcZ9TvhdBkaO5O55kpjEuHJR6GdGm4kQglVt fEmIr2e4MEXpdy3ahh7/hslFaq/p5xjYhZlvbN7El0nJt4a3L7MWCD9kLndPSjTqPQD4kB c4RNXu2WHC3LuUKTMLfDFuFaoCWDohQ= Date: Tue, 24 May 2022 19:30:43 +0200 From: Borislav Petkov To: Linus Torvalds Cc: Mark Hemment , Andrew Morton , the arch/x86 maintainers , Peter Zijlstra , patrice.chotard@foss.st.com, Mikulas Patocka , Lukas Czerner , Christoph Hellwig , "Darrick J. Wong" , Chuck Lever , Hugh Dickins , patches@lists.linux.dev, Linux-MM , mm-commits@vger.kernel.org, Mel Gorman Subject: Re: [PATCH] x86/clear_user: Make it faster Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 77FB01C0022 X-Rspam-User: Authentication-Results: imf20.hostedemail.com; dkim=temperror ("DNS error when getting key") header.d=alien8.de header.s=dkim header.b=k3eaDOkk; spf=temperror (imf20.hostedemail.com: error in processing during lookup of bp@alien8.de: DNS error) smtp.mailfrom=bp@alien8.de; dmarc=temperror reason="query timed out" header.from=alien8.de (policy=temperror) X-Stat-Signature: ra8hku4bgsfeqnhod9dbj3opobsugqks X-HE-Tag: 1653413449-651470 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: On Tue, May 24, 2022 at 09:51:56AM -0700, Linus Torvalds wrote: > I can't find anything wrong with this, but who knows what > patch-blindness I have from looking at a few different versions of it. > Maybe my eyes just skim over it now. Same here - I can't look at that code anymore. I'll try to gain some distance and look at it again later, and do some more extensive testing too. > I do note that the clearing of %rax here: > > > +.Lerms_exit: > > + xorl %eax,%eax > > + RET > > seems to be unnecessary, since %rax is never modified in the path > leading to this. But maybe just as well just for consistency with the > cases where it *is* used as a temporary. Yeah. > And I still suspect that "copy_to_user()" is *much* more interesting > than "clear_user()", but I guess we can't inline it anyway due to all > the other overhead (ie access_ok() and stac/clac). > > And for a plain "call memcpy/memset", we'd need compiler help to do > this (at a minimum, we'd have to have the compiler use the 'rep > movs/stos' register logic, and then we could patch things in place > afterwards, with objtool creating the alternatives section or > something). Yeah, I have this on my todo to research them properly. Will report when I have something. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette