From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753868AbcEIXzO (ORCPT ); Mon, 9 May 2016 19:55:14 -0400 Received: from mga11.intel.com ([192.55.52.93]:61802 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753679AbcEIXzM (ORCPT ); Mon, 9 May 2016 19:55:12 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,602,1455004800"; d="scan'208";a="976111091" Date: Mon, 9 May 2016 16:50:42 -0700 From: Yu-cheng Yu To: Dave Hansen Cc: linux-kernel@vger.kernel.org, x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , Andy Lutomirski , Borislav Petkov , Sai Praneeth Prakhya , "Ravi V. Shankar" , Fenghua Yu Subject: Re: [PATCH v5 12/13] x86/xsaves: Fix fpstate_init() for XSAVES Message-ID: <20160509235042.GB28442@test-lenovo> References: <9c6c58a0a4a66568b8e887944d2426d59370ae05.1462816638.git.yu-cheng.yu@intel.com> <5731202B.2050805@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5731202B.2050805@linux.intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 09, 2016 at 04:41:31PM -0700, Dave Hansen wrote: > On 05/09/2016 01:46 PM, Yu-cheng Yu wrote: > > When XSAVES is used, xsave.header.xcomp_bv[63] must be set. > > So, that's not strictly correct. XSAVES can write to a completely empty > (0'd) memory buffer. It's only XRSTORS that _needs_ bit 63 set. The > instruction reference is pretty clear on this point. You mean the comments? I will change it to XRSTORS. > > Oh, and if you decided to do this for some reason, please have mercy and > go make a macro for 1<<63. > > Also, I don't think the kernel ever checks for this bit. So are we > really calling XRSTORS on otherwise uninitialized xsave buffers? Right now if we do fpstate_init(), without this patch, it will trigger a warning from copy_kernel_to_fxregs() when the task is scheduled.