From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751376AbdA2PNa (ORCPT ); Sun, 29 Jan 2017 10:13:30 -0500 Received: from mga07.intel.com ([134.134.136.100]:15299 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751211AbdA2PN0 (ORCPT ); Sun, 29 Jan 2017 10:13:26 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,306,1477983600"; d="scan'208";a="37008510" Date: Sun, 29 Jan 2017 17:11:08 +0200 From: Jarkko Sakkinen To: Andy Shevchenko Cc: intel-sgx-kernel-dev@ml01.01.org, Darren Hart , "open list:X86 PLATFORM DRIVERS" , open list Subject: Re: [PATCH 1/3] intel_sgx: do not use BUG() in sgx_free_page() Message-ID: <20170129151108.kpyyf3oksfrxqqhs@intel.com> References: <20170126212038.12809-1-jarkko.sakkinen@linux.intel.com> <20170126212038.12809-2-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.6.2-neo (2016-08-21) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 27, 2017 at 05:45:03PM +0200, Andy Shevchenko wrote: > On Thu, Jan 26, 2017 at 11:20 PM, Jarkko Sakkinen > wrote: > > EREMOVE fails on non-EPC page or when a SECS page with children is to be > > removed. These do not happen if the driver is working correctly. Log the > > error but do not crash the driver. > > > > Signed-off-by: Jarkko Sakkinen > > --- > > drivers/platform/x86/intel_sgx_page_cache.c | 6 ++---- > > 1 file changed, 2 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/platform/x86/intel_sgx_page_cache.c b/drivers/platform/x86/intel_sgx_page_cache.c > > index d073057..7f73ac7 100644 > > --- a/drivers/platform/x86/intel_sgx_page_cache.c > > +++ b/drivers/platform/x86/intel_sgx_page_cache.c > > @@ -551,10 +551,8 @@ void sgx_free_page(struct sgx_epc_page *entry, > > ret = __eremove(epc); > > sgx_put_epc_page(epc); > > > > - if (ret) { > > - pr_err("EREMOVE returned %d\n", ret); > > - BUG(); > > - } > > + if (ret) > > + sgx_err(encl, "EREMOVE returned %d\n", ret); > > Do you have something like critical level? For me seems reasonable to > increase the level of message if BUG() was somehow related to actual > situation. Hmm... I think that would make sense. This could only happen when the driver implementation is working incorrectly. /Jarkko