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 X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3798FC2D0A8 for ; Wed, 23 Sep 2020 10:42:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E403821D7D for ; Wed, 23 Sep 2020 10:42:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alien8.de header.i=@alien8.de header.b="L/wQbhB7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726518AbgIWKmI (ORCPT ); Wed, 23 Sep 2020 06:42:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726130AbgIWKmD (ORCPT ); Wed, 23 Sep 2020 06:42: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 5CBB6C0613CE for ; Wed, 23 Sep 2020 03:42:03 -0700 (PDT) Received: from zn.tnic (p200300ec2f0d1300e5068c8a3292d31d.dip0.t-ipconnect.de [IPv6:2003:ec:2f0d:1300:e506:8c8a:3292:d31d]) (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 925411EC0409; Wed, 23 Sep 2020 12:42:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1600857720; 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=mZ44VK00oyAW9zTeN7/p+FrZ3CRlHQjymafdlc3xK8o=; b=L/wQbhB7bwaUyRmOBDJhYFkrEnTmEvJQum8y3w4RbwnwF1lUFwzQvniPc8VfMiKuxAQV2V /XJKOThKGtI4/rULGRA/QkKkOb0m2riO8fblOBba5KY6U9AMFKN9TE2Z1VJz0IpK4DpEWM 9WsSq/09TLxvAqYmpYTfBsVr6qOiH2Q= Date: Wed, 23 Sep 2020 12:41:58 +0200 From: Borislav Petkov To: Dave Jiang Cc: vkoul@kernel.org, tglx@linutronix.de, mingo@redhat.com, dan.j.williams@intel.com, tony.luck@intel.com, jing.lin@intel.com, ashok.raj@intel.com, sanjay.k.kumar@intel.com, fenghua.yu@intel.com, kevin.tian@intel.com, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 1/5] x86/asm: move the raw asm in iosubmit_cmds512() to special_insns.h Message-ID: <20200923104158.GG28545@zn.tnic> References: <160037680630.3777.16356270178889649944.stgit@djiang5-desk3.ch.intel.com> <160037731654.3777.18071122574577972463.stgit@djiang5-desk3.ch.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <160037731654.3777.18071122574577972463.stgit@djiang5-desk3.ch.intel.com> Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org > Subject: Re: [PATCH v4 1/5] x86/asm: move the raw asm in iosubmit_cmds512() to special_insns.h Start patch name with a capital letter: "Move the asm definition.." Also, calling stuff "raw" and "core" is misleading in the kernel context - you wanna say simply: "Carve out a generic movdir64b() helper... " On Thu, Sep 17, 2020 at 02:15:16PM -0700, Dave Jiang wrote: > diff --git a/arch/x86/include/asm/special_insns.h b/arch/x86/include/asm/special_insns.h > index 59a3e13204c3..7bc8e714f37e 100644 > --- a/arch/x86/include/asm/special_insns.h > +++ b/arch/x86/include/asm/special_insns.h > @@ -234,6 +234,23 @@ static inline void clwb(volatile void *__p) > > #define nop() asm volatile ("nop") > > +static inline void movdir64b(void *__dst, const void *src) Make __dst be the function local variable name and keep "dst", i.e., without the underscores, the function parameter name. > + /* > + * Note that this isn't an "on-stack copy", just definition of "dst" > + * as a pointer to 64-bytes of stuff that is going to be overwritten. > + * In the MOVDIR64B case that may be needed as you can use the > + * MOVDIR64B instruction to copy arbitrary memory around. This trick > + * lets the compiler know how much gets clobbered. > + */ > + volatile struct { char _[64]; } *dst = __dst; > + > + /* MOVDIR64B [rdx], rax */ > + asm volatile(".byte 0x66, 0x0f, 0x38, 0xf8, 0x02" > + : "=m" (dst) > + : "d" (src), "a" (dst)); > +} > + > #endif /* __KERNEL__ */ > > #endif /* _ASM_X86_SPECIAL_INSNS_H */ > -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette