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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0600C43334 for ; Mon, 11 Jul 2022 11:15:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230462AbiGKLPg (ORCPT ); Mon, 11 Jul 2022 07:15:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230268AbiGKLPD (ORCPT ); Mon, 11 Jul 2022 07:15:03 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FE21301; Mon, 11 Jul 2022 03:33:33 -0700 (PDT) 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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