Re: [RFC PATCH 02/14] mm/hms: heterogenenous memory system (HMS) documentation

From: Logan Gunthorpe
Date: Tue Dec 04 2018 - 15:30:23 EST




On 2018-12-04 1:13 p.m., Jerome Glisse wrote:
> You are right many are non exclusive. It is just my feeling that having
> a mask as a file inside the target directory might be overlook by the
> application which might start using things it should not. At same time
> i guess if i write the userspace library that abstract this kernel API
> then i can enforce application to properly select thing.

I think this is just evidence that this is not a good API. If the user
has the option to just ignore things or do it wrong that's a problem
with the API. Using a prefix for the name doesn't change that fact.

> I do not think there is a way to answer that question. I am siding on the
> side of this API can be dumb down in userspace by a common library. So let
> expose the topology and let userspace dumb it down.

I fundamentally disagree with this approach to designing APIs. Saying
"we'll give you the kitchen sink, add another layer to deal with the
complexity" is actually just eschewing API design and makes it harder
for kernel folks to know what userspace actually requires because they
are multiple layers away.

> If we dumb it down in the kernel i see few pitfalls:
> - kernel dumbing it down badly
> - kernel dumbing down code can grow out of control with gotcha
> for platform

This is just a matter of designing the APIs well. Don't do it badly.

> - it is still harder to fix kernel than userspace in commercial
> user space (the whole RHEL business of slow moving and long
> supported kernel). So on those being able to fix thing in
> userspace sounds pretty enticing

I hear this argument a lot and it's not compelling to me. I don't think
we should make decisions in upstream code to allow RHEL to bypass the
kernel simply because it would be easier for them to distribute code
changes.

Logan