Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4948243img; Tue, 26 Mar 2019 21:54:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqyaWQBv2CGHNu1DK35TTb3f03F5GgsL5/N7Mc8sJ+QSRAGVuOxPyp+3r7IcvBp92zGehM/h X-Received: by 2002:a63:2b82:: with SMTP id r124mr32128851pgr.214.1553662479407; Tue, 26 Mar 2019 21:54:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553662479; cv=none; d=google.com; s=arc-20160816; b=gaChtzEPv0k4khsq/wEDFiXALr82g8O3QkbIOdEXgPBIXVzeDxK0pegEBepKl8z2Tq 2birdBQpy6+i8zQagsRrGwteEWQx5QG+i+7kTa4g6ZpX0YXJ54ipsAh+Aa8NeYSVPjyp 1WggLC6M+QERX0ucbGPmI1g/Q8y5K35bTejC3+fyje4jOQlv7KjxTCn7eP+xp+9W5Rm2 IgQ7yKOkU+6Boag7yXU2IHqsEsq4siReqd58N+rXanAnprJln3CLoR09GmrMqskcE+0M y5YAeU+zLOFaqWWzMjFkPZSKlMBnVT1L6FL9PZ19GllfvObNKkLJcz6pSz7YiK+8yRRe qEjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=prokOlCe+s9yIeNZsimabobnZ7sRQXNJ12K/7R7T/7Y=; b=pX/yB8T/LA91xFF6pNFjq9A2ds/KKU+FWW1f26vVKPyWFgR7A2o78XALWVfPqCesNn mgSjTXScTdoyaniQrxxhN0qrJ17dVdB48twglL7YXyJRa65KgfrAh4OnHZhhytzxFrzY nWDTsnRKr5uctZH9rcQUBB/muhHQVYeJi3BB2Dzm8EcimwhO3j14mPJPmRHWONsb0J96 UGY5jbLo+1M59H1Cq5nwhgxzCKZhIROQA2+y9Bf1m8YZt3SzxdNB2B09+8E+WGaJF6lS bytiw3K3RGjERrBHxam1wF26Gb66Df1yVI2U39serMnau1X3m/0tIVWY3jAc+kt/BW+X bfKg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v24si8944254pgi.286.2019.03.26.21.54.12; Tue, 26 Mar 2019 21:54:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726147AbfC0ExK (ORCPT + 99 others); Wed, 27 Mar 2019 00:53:10 -0400 Received: from mga14.intel.com ([192.55.52.115]:11951 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725616AbfC0ExK (ORCPT ); Wed, 27 Mar 2019 00:53:10 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Mar 2019 21:53:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,275,1549958400"; d="scan'208";a="332379504" Received: from hao-dev.bj.intel.com (HELO localhost) ([10.238.157.65]) by fmsmga005.fm.intel.com with ESMTP; 26 Mar 2019 21:53:07 -0700 Date: Wed, 27 Mar 2019 12:37:43 +0800 From: Wu Hao To: Scott Wood Cc: Alan Tull , Moritz Fischer , linux-fpga@vger.kernel.org, linux-kernel , linux-api@vger.kernel.org, Ananda Ravuri , Xu Yilun Subject: Re: [PATCH 03/17] fpga: dfl: fme: support 512bit data width PR Message-ID: <20190327043743.GA20968@hao-dev> References: <1553483264-5379-1-git-send-email-hao.wu@intel.com> <1553483264-5379-4-git-send-email-hao.wu@intel.com> <127a9356a7bf597d35dd361f2b16bf80460f0370.camel@redhat.com> <655bf2991a4f8bf6a473c91218d6dba7748520aa.camel@redhat.com> <580c6c604d3915c105f076fc7f22ab5da98598fc.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <580c6c604d3915c105f076fc7f22ab5da98598fc.camel@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 26, 2019 at 04:22:34PM -0500, Scott Wood wrote: > On Tue, 2019-03-26 at 14:33 -0500, Alan Tull wrote: > > On Mon, Mar 25, 2019 at 5:58 PM Scott Wood wrote: > > > > Hi Scott, > > > > > On Mon, 2019-03-25 at 17:53 -0500, Scott Wood wrote: > > > > On Mon, 2019-03-25 at 11:07 +0800, Wu Hao wrote: > > > > > +#if defined(CONFIG_X86) && defined(CONFIG_AS_AVX512) > > > > > + > > > > > +#include > > > > > + > > > > > +static inline void copy512(void *src, void __iomem *dst) > > > > > +{ > > > > > + kernel_fpu_begin(); > > > > > + > > > > > + asm volatile("vmovdqu64 (%0), %%zmm0;" > > > > > + "vmovntdq %%zmm0, (%1);" > > > > > + : > > > > > + : "r"(src), "r"(dst)); > > > > > + > > > > > + kernel_fpu_end(); > > > > > +} > > > > > > > > Shouldn't there be some sort of check that AVX512 is actually > > > > supported > > > > on the running system? > > > > > > > > Also, src should be const, and the asm statement should have a memory > > > > clobber. Yes, I will fix this in the next version. > > > > > > > > > +#else > > > > > +static inline void copy512(void *src, void __iomem *dst) > > > > > +{ > > > > > + WARN_ON_ONCE(1); > > > > > +} > > > > > +#endif > > > > > > > > Likewise, this will be called if a revision 2 device is used on non- > > > > x86 > > > > (or on x86 with an old binutils). The driver should fall back to 32- > > > > bit > > > > in such cases. Unfortunately revision 2 is only for integrated FPGA solution, and it doesn't support any fallback solution (original 32bit data partial reconfiguration is not supported any more), so driver has to WARN in such path. > > > > > > Sorry, I missed the comment about revision 2 only being on integrated > > > devices -- but will that always be the case? Seems worthwhile to check > > > for > > > AVX512 support anyway. And there's still the possibility of being built > > > with an old binutils such that CONFIG_AS_AVX512 is not set, or running > > > on a > > > kernel where avx512 was disabled via a boot option. > > > > The code checks for CONFIG_AS_AVX512 above. > > That just indicates that binutils supports it. Plus, the code does not > check for CONFIG_AS_AVX512 when deciding whether to set pr_datawidth to 64 > (and thus call copy512), so you'll get a WARN_ON rather than falling back to > 32-bit. > > > What boot option are you referring to? > > clearcpuid=304 Just tried it, my system was down after running above AVX512 with this option. I agree that it needs to add some check code to make sure it's safe to run such instructions. I will add some cpu_feature_enabled() check in the next version. Thanks a lot for the review and comments. Hao > > -Scott >