On Wed, Sep 06, 2017 at 11:18:42AM +1200, Kai Huang wrote:
On Tue, 2017-09-05 at 22:28 +0300, Jarkko Sakkinen wrote:
> On Tue, Sep 05, 2017 at 10:14:11PM +0300, Jarkko Sakkinen wrote:
> > On Tue, Sep 05, 2017 at 01:42:30PM +0000, Christopherson, Sean J
> > wrote:
> > > On Sat, Sep 02, 2017 at 01:28:54PM +0300, Jarkko Sakkinen wrote:
> > > > On Thu, Aug 31, 2017 at 04:52:17PM +0000, Christopherson, Sean
> > > > J wrote:
> > > > > On Wed, Aug 30, 2017 at 09:47:05PM +0300, Jarkko Sakkinen
> > > > > wrote:
> > > > > > On Tue, Aug 29, 2017 at 10:56:36AM -0700, Sean
> > > > > > Christopherson wrote:
> > > > > > > Build SGX support directly into the kernel, utilizing
> > > > > > > syscore_ops
> > > > > > > instead of dev_pm_ops to hook into the suspend flow.
> > > > > > >
> > > > > > > Signed-off-by: Sean Christopherson
<sean.j.christopherson
> > > > > > > @intel.com>
> > > > > >
> > > > > > I think you are looking this only from container
> > > > > > perspective. For
> > > > > > desktop distribution it *does* make sense to be able to
> > > > > > compile
> > > > > > this as a module.
> > > > > >
> > > > > > /Jarkko
> > > > >
> > > > > I don't disagree that building SGX as module is
> > > > > valuable. Even for
> > > > > server/container/VM environments it would be nice to have the
> > > > > driver
> > > > > built as a loadable module.
> > > > >
> > > > > The core issue is that taking a dependency on a loadable
> > > > > module is
> > > > > Simply not possible for a cgroup, and while possible for KVM,
> > > > > is not
> > > > > ideal. Various workarounds are possible, but they are either
> > > > > ugly,
> > > > > i.e. will never be accepted upstream, or don't really solve
> > > > > the
> > > > > problem, e.g. forcing SGX to be built-in to enable the EPC
> > > > > cgroup
> > > > > basically forces distros to decide between the cgroup and
> > > > > building
> > > > > SGX as a module.
> > > >
> > > > IMA depends on the TPM driver and requires it to be linked
> > > > directly to
> > > > the kernel if it is enabled i.e. use 'y'. It's a much
better
> > > > solution
> > > > and there are already existing examples of this in the mainline
> > > > kernel.
> > >
> > > It's a simpler solution, but I think taking that route will
> > > result in all
> > > distros compiling the SGX driver as a built-in, which defeats the
> > > purpose
> > > of allowing the SGX driver to be a loadable module.
> >
> > So happens with TPM driver for most of the distros. It still gives
> > some flexibility and does not cause much harm.
> >
> > It will also easier for me to maintain SGX tree, collect patches
> > and
> > send pull requests for upper layer maintainers for future kernel
> > releases.
> >
> > Sprinkling properly encapsulated code is really an antipattern.
> >
> > /Jarkko
>
> There's also things when you move into maintainer mode like
> backporting
> bug fixes for stable kernels and stuff like this. Distro maintainers
> and
> Greg K-H will probably like the current organization more...
Hi Jarkko,
From maintain's view, I think there's already plenty examples that one
maintainer maintains files under several folders. For example, KVM
maintainer maintains files both under virt/kvm/ and arch/*/kvm/. Is
there any particular difficulty if part of SGX code is under, ex,
arch/x86/kernel/cpu/ ?
There must have been a good reason to do this for kvm. There's not
reason to complicate thing for SGX.
I am not sure about TPM but for SGX, but KVM actually only needs to
depend on part of your SGX code. Moving some core SGX functions to
arch/x86/kernel/cpu/ simplifies KVM and cgroup's implementation and at
meantime, provides more flexibility (ie, still allow SGX driver to be a
loadable module).
Thanks,
-Kai
Still don't understand why you can't just require to link SGX to vmlinux
when needed.
/Jarkko