Re: [PATCH v23 12/24] x86/sgx: Linux Enclave Driver

From
Jarkko Sakkinen <hidden>
Date
2019-12-06 20:38:19
Also in
lkml
Reply to
Greg KH, 2019-11-28
On Thu, Nov 28, 2019 at 07:24:50PM +0100, Greg KH wrote:
On Mon, Oct 28, 2019 at 11:03:12PM +0200, Jarkko Sakkinen wrote:
quoted
+static struct device sgx_encl_dev;
Ugh, really?  After 23 versions of this patchset no one saw this?
Nobody has really given feedback on the device model. This is the
first review on that and thanks for taking your time. Previously
feeback has been mainly on the ioctl API and file management.
quoted
+static dev_t sgx_devt;
+
+static void sgx_dev_release(struct device *dev)
+{
+}
The old kernel documentation used to say I was allowed to make fun of
people who did this, but that was removed as it really wasn't that nice.

But I'm seriously reconsidering that at the moment.

No, this is NOT OK!

Think about what you are doing here, and why you feel that it is ok to
work around a kernel message that was added there explicitly to help you
do things the right way.  I didn't add it just because I felt like it, I
was trying to give you a chance to not get the use of this api
incorrect.

That failed :(

Ugh, not ok.  Seriously, not ok...
It used to delete a context structure called sgx_dev_ctx. This structure
was removed in v20. I've failed to notice this when the code was refactored
for v20.
Why a whole cdev?

Why not use a misc device?  YOu only have 2 devices right?  Why not 2
misc devices then?  That saves the use of a whole major number and makes
your code a _LOT_ simpler.
The downside would be that if we ever want to add sysfs attributes, that
could not be done synchronously with the device creation.

/Jarkko
Thread (18 messages) 18 messages, 4 authors, last reply 2019-12-23
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help