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 D128DC43334 for ; Mon, 11 Jul 2022 10:33:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5B17C6B00BD; Mon, 11 Jul 2022 06:33:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 539586B00BE; Mon, 11 Jul 2022 06:33:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4007B6B00BF; Mon, 11 Jul 2022 06:33:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 2D1C06B00BD for ; Mon, 11 Jul 2022 06:33:44 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id ED31660A15 for ; Mon, 11 Jul 2022 10:33:42 +0000 (UTC) X-FDA: 79674457884.07.6DF8226 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by imf15.hostedemail.com (Postfix) with ESMTP id 93E3BA005A for ; Mon, 11 Jul 2022 10:33:34 +0000 (UTC) Received: from zn.tnic (p200300ea970ff601329c23fffea6a903.dip0.t-ipconnect.de [IPv6:2003:ea:970f:f601: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 317821EC0567; Mon, 11 Jul 2022 12:33:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1657535606; 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=mtjDsDO71nPhY5TZ9r2wPpSA0kUObkSTB+i8h+NQfsw=; b=M+c3B7xVKSjX18CkA4XSZarUwA9h9PAxou8AWmpppYs69p36vamcy9Gj467He+fOihRu+n mDIGn/qZQZ5HIj3wI4ly3WwM17zZIk/Lz8K51d0lEjqHmtgwL6cLfbyQ+/R7odH5VQvrO+ 7Zn8arslSwSwEqL0cbIpNTaPSAhJRaA= Date: Mon, 11 Jul 2022 12:33:20 +0200 From: Borislav Petkov To: Alexey Dobriyan Cc: linux-kernel@vger.kernel.org, Linus Torvalds , 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 -final] 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: Authentication-Results: imf15.hostedemail.com; dkim=temperror ("DNS error when getting key") header.d=alien8.de header.s=dkim header.b=M+c3B7xV; dmarc=temperror reason="query timed out" header.from=alien8.de (policy=temperror); spf=temperror (imf15.hostedemail.com: error in processing during lookup of bp@alien8.de: DNS error) smtp.mailfrom=bp@alien8.de X-Stat-Signature: supjunt3awdzu8f84bffpshnj4re14cn X-Rspamd-Queue-Id: 93E3BA005A X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1657535614-220056 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 Wed, Jul 06, 2022 at 12:24:12PM +0300, Alexey Dobriyan wrote: > On Tue, Jul 05, 2022 at 07:01:06PM +0200, Borislav Petkov wrote: > > > + asm volatile( > > + "1:\n\t" > > + ALTERNATIVE_3("rep stosb", > > + "call clear_user_erms", ALT_NOT(X86_FEATURE_FSRM), > > + "call clear_user_rep_good", ALT_NOT(X86_FEATURE_ERMS), > > + "call clear_user_original", ALT_NOT(X86_FEATURE_REP_GOOD)) > > + "2:\n" > > + _ASM_EXTABLE_UA(1b, 2b) > > + : "+&c" (size), "+&D" (addr), ASM_CALL_CONSTRAINT > > + : "a" (0) > > + /* rep_good clobbers %rdx */ > > + : "rdx"); > > "+c" and "+D" should be enough for 1 instruction assembly? I'm looking at e0a96129db57 ("x86: use early clobbers in usercopy*.c") which introduced the early clobbers and I'm thinking we want them because "this operand is an earlyclobber operand, which is written before the instruction is finished using the input operands" and we have exception handling. But maybe you need to be more verbose as to what you mean exactly... -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette