From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756409AbcBVXaE (ORCPT ); Mon, 22 Feb 2016 18:30:04 -0500 Received: from mga14.intel.com ([192.55.52.115]:10716 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755877AbcBVXaC (ORCPT ); Mon, 22 Feb 2016 18:30:02 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,486,1449561600"; d="scan'208";a="918809993" Date: Mon, 22 Feb 2016 15:27:38 -0800 From: Yu-cheng Yu To: Andy Lutomirski Cc: X86 ML , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , "linux-kernel@vger.kernel.org" , Dave Hansen , Andy Lutomirski , Borislav Petkov , Sai Praneeth Prakhya , "Ravi V. Shankar" , Fenghua Yu Subject: Re: [PATCH 04/10] x86/xsaves: Introduce a new check that allows correct xstates copy from kernel to user directly Message-ID: <20160222232738.GB4259@test-lenovo> References: <1456167528-3806-1-git-send-email-yu-cheng.yu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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, Feb 22, 2016 at 02:42:54PM -0800, Andy Lutomirski wrote: > > +static int should_save_registers_directly(void) > > I don't like the name of this function because: > > > +{ > > + /* > > + * In signal handling path, the kernel already checks if > > + * FPU instructions have been used before it calls > > + * copy_fpstate_to_sigframe(). We check this here again > > + * to detect any potential mis-use and saving invalid > > + * register values directly to a signal frame. > > + */ > > + WARN_ONCE(!current->thread.fpu.fpstate_active, > > + "direct FPU save with no math use\n"); > > ... Here "direct" seems to mean that we're asking whether to directly save ... > > > + > > + /* > > + * In the case that we are using a compacted kernel > > + * xsave area, we can not copy the thread.fpu.state > > + * directly to userspace and *must* save it from the > > + * registers directly. > > + */ > > ... and here "directly" means *both* copying directly to userspace and > saving using xsave directly. > > So can you rename it to something with an obvious meaning like > "may_memcpy_fpu_regs" or similar? This function determines whether the kernel should do copy_fpregs_to_sigframe(). Perhaps we can re-name it to may_copy_fpregs_to_sigframe()? --Yu-cheng