Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4265286imm; Mon, 11 Jun 2018 09:28:25 -0700 (PDT) X-Google-Smtp-Source: ADUXVKItZS9upE/iHRnrYGeRZaWKapLwB6a4tFzPvZAy4Y/MUYfnZbfiW5M1PVfn1c+HqEphxXWT X-Received: by 2002:a63:6142:: with SMTP id v63-v6mr15031158pgb.390.1528734505786; Mon, 11 Jun 2018 09:28:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528734505; cv=none; d=google.com; s=arc-20160816; b=wqtSludp38A4XQgNMUSKzc2z28Sm4MQPzIM49t3gvU4ejdnEyKTa8pSSrqQlNJK1Ro MPHam2wBqC+zt9YxdbFNSoT9yn36WOcJ1t45APmaHoCgyu4V1nZG/I838cD1LslKEQwk 4IsULbIqJCpj1hz60RzbIki5GN3KaiPqS/2llJo1xPySVK5c0aT06TPV0JtnM9bmEmLf t55q+41g+ZaXTA9wMR+FwO8hgv0ZQbTtZiyz8lGxW8Lztt//qgRCluMaUgm2s/OBlqTj jslDsZ7YRNpgzRexYtzEVBlNOWHf9C/j80HzIJPhOb5RdspE8JmWpFD5Z3VugQOjs1XR E4qQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=v5U/5E25sEIfd8Kylc5nPMwiqiFyspcdPglS/0+bMY4=; b=AKOuLMTR5Wp9PLMq/GM78zyz97NjcpM3KZs5SmFFwq2yXQLwwflBltd0rgYkw7dE5J Noc04Vy38i0wG02zjBjWF4ZmU3KadzGN+Vl8QBhuU1NCdb9hd51Xx/wsWWnvIRWEx1Dx jvLSaU7PBRw9nCIUrMSmD8XHnoNEKbuBxjJrysO83h19H2ckTi427miDQg9chvGiItGX q/2knOo389pGcnZF3R1X50mEe2DUqEc0g5IoRYTehedm565mXf0GBZBTdpJ8+lmIm3U9 8tlJkposxJml70uorp/cdzoseMxLVlwLxicymFf18bA6wYbFAL1xldghyT+Q/rA3tc5p z0sQ== 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 x66-v6si476356pfx.67.2018.06.11.09.28.11; Mon, 11 Jun 2018 09:28:25 -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 S1753965AbeFKPCM (ORCPT + 99 others); Mon, 11 Jun 2018 11:02:12 -0400 Received: from mga05.intel.com ([192.55.52.43]:43617 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751968AbeFKPCK (ORCPT ); Mon, 11 Jun 2018 11:02:10 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jun 2018 08:02:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,502,1520924400"; d="scan'208";a="63614978" Received: from sjchrist-coffee.jf.intel.com ([10.54.74.135]) by orsmga001.jf.intel.com with ESMTP; 11 Jun 2018 08:02:09 -0700 Message-ID: <1528729329.9779.28.camel@intel.com> Subject: Re: [PATCH v11 11/13] intel_sgx: ptrace() support From: Sean Christopherson To: Dave Hansen , Jarkko Sakkinen , x86@kernel.org, platform-driver-x86@vger.kernel.org Cc: nhorman@redhat.com, npmccallum@redhat.com, Darren Hart , Andy Shevchenko , "open list:INTEL SGX" , open list Date: Mon, 11 Jun 2018 08:02:09 -0700 In-Reply-To: <91e35b3e-b42d-b3d5-752c-031973e69273@intel.com> References: <20180608171216.26521-1-jarkko.sakkinen@linux.intel.com> <20180608171216.26521-12-jarkko.sakkinen@linux.intel.com> <91e35b3e-b42d-b3d5-752c-031973e69273@intel.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.18.5.2-0ubuntu3.2 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2018-06-08 at 11:34 -0700, Dave Hansen wrote: > On 06/08/2018 10:09 AM, Jarkko Sakkinen wrote: > > > > + ret = sgx_edbgrd(encl, entry, align, data); > > + if (ret) > > + break; > > + if (write) { > > + memcpy(data + offset, buf + i, cnt); > > + ret = sgx_edbgwr(encl, entry, align, data); > > + if (ret) > > + break; > > + } > > + else > > + memcpy(buf + i,data + offset, cnt); > > + } > The SGX instructions like "edbgrd" be great to put on a license plat, > but we can do better in the kernel.  Can you give these reasonable > english names, please?  sgx_debug_write(), maybe? IMO the function names for ENCLS leafs are appropriate.  The real issue is the lack of documentation of the ENCLS helpers and their naming conventions. The sgx_ functions, e.g. sgx_edbgrd(), are essentially direct invocations of the specific leaf, i.e. they are dumb wrappers to the lower level leaf functions, e.g. __edbgrd().  The wrappers exist primarily to deal with the boilerplate necessary to access a page in the EPC.  sgx_ conveys that the function contains the preamble and/or postamble needed to execute its leaf, but otherwise does not contain any logic. Functions with actual logic do have English names, e.g. sgx_encl_init(), sgx_encl_add_page(), sgx_encl_modify_pages() etc... > Note that we have plenty of incomprehensible instruction names in the > kernel like "wrpkru", but we do our best to keep them as confined as > possible and make sure they don't hurt code readability.