[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v4 12/16] xen/mm: Switch common/memory.c to use typesafe MFN



Hi Jan,

On 03/12/2018 06:39 AM, Jan Beulich wrote:
Julien Grall <julien.grall@xxxxxxx> 03/11/18 8:44 PM >>>
On 03/09/2018 05:33 PM, Wei Liu wrote:
On Mon, Mar 05, 2018 at 07:41:54AM -0700, Jan Beulich wrote:
On 05.03.18 at 15:18, <julien.grall@xxxxxxx> wrote:
Also, do you have an opinion on Wei's suggestion:

"What I meant was to make copy_{to,from}_guest* type-safe. I just feel it
a bit strange you only created a wrapper for this file. I wonder why.

Note I'm just asking question. That's not necessarily a good idea to
turn them all in the end."

Well, I didn't really understand what he's after (in the context of
this series) - copy_{to,from}_guest() don't take or return MFNs or
GFNs.


Fundamentally Julien's patch is to wrap around an existing API for this
one file only. Why is this file special? Why not just make that class of
APIs do what he wants?

But that is going to be intrusive and a bit counter-intuitive.

I have quickly looked at it. The major problem I can see is it is not
possible to generically define for any typesafe. Indeed, TYPE_SAFE(...)
cannot define new macro and, AFAICT, it is not feasible to define static
inline for copy_* helpers.

So we would need to introduce macros for each typesafe by hand. I can
move copy_mfn_to_guest in xen/mm.h if people think it could be useful.

First of all - how often do we copy in/out individual MFNs? Not in many places,
I think. Hence I'm afraid I continue to not see the value of such a construct,
especially not as a wider-than-file-scope one.

I think you are right. Looking at the interface, we tend copy copy more often a GFN. We might want to provide an helper for typesafe GFN in the future.

Cheers.

--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.