From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754860AbcEDWuq (ORCPT ); Wed, 4 May 2016 18:50:46 -0400 Received: from mga01.intel.com ([192.55.52.88]:42775 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754591AbcEDWup (ORCPT ); Wed, 4 May 2016 18:50:45 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,579,1455004800"; d="scan'208";a="696910438" Date: Wed, 4 May 2016 15:46:30 -0700 From: Yu-cheng Yu To: Dave Hansen Cc: x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, Andy Lutomirski , Borislav Petkov , Sai Praneeth Prakhya , "Ravi V. Shankar" , Fenghua Yu Subject: Re: [PATCH v4 10/10] x86/xsaves: Re-enable XSAVES Message-ID: <20160504224630.GA13223@test-lenovo> References: <572A7AAD.5040201@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <572A7AAD.5040201@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 Wed, May 04, 2016 at 03:41:49PM -0700, Dave Hansen wrote: > It's my fault, but you also need to go update > > fpu__xfeature_set_state() > and > __raw_xsave_addr() > > The theoretical problem is that you might ask for a __raw_xsave_addr() > of a component which has been compacted out of an XSAVES buffer and thus > has no address. We could work around this by doing a memmove() and > moving the components "up" after the one we are trying to set in order > to make space. > > But, since we *always* call XSAVES with an instruction mask of -1 and > end up with a requested feature bitmap (RFBM) equal to XCR0, I think we > can do a shortcut because we'll practically *always* have an > xcomp_bv==RFBM==XCR0, which means that all (present) components will > always have an address. > > So, the alternative to doing the memmove() is to add some WARN_ON_FPU() > checks to enforce xcomp_bv==RFBM==XCR0 in places where we call > XSAVES/XRSTORS and __raw_xsave_addr(), maybe more. In the coming version 5 patches, we are going to have one additional patch for fixing __fpu_restore_sig() for the compacted format. I changed my existing patch a little and run into some problems. Fixing it now. Our ptrace tests went OK before, but are failing now. It might be relating to what you are saying? I will check it.