From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4EBEA1879 for ; Mon, 11 Jul 2022 10:33:38 +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: Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: 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