question about atomic get_page
Now get_page on x86 is implemented to atomic exchange both _domain and count_info simultaneously. Cmpxchg8b is used to cover two fields because they are all 32bit width.
However on ia64 where _domain is 64bit, hard to use single instruction to cover two fields. Yes, there's workaround to solve that, like adding spinlock with some overhead. But I'd like to know the reason why _domain and count_info should be operated together. Is there any case that ownership changes just after checking ownership and before modifying count_info?
Thanks,
Kevin
Quoted 6 lines · Kevin
However on ia64 where
_domainis 64bit, hard to use single instruction to cover two fields. Yes, there's workaround to solve that, like adding spinlock with some overhead. But I'd like to know the reason why_domainandcount_infoshould be operated together. Is there any case that ownership changes just after checking ownership and before modifyingcount_info?
There'd be nothing to stop the domain pointer changing while you modify the reference count. On x86/64 we 'pickle' the domain pointer into a 32-bit field by simply masking off the high bits. Do you really need the 64-bit range? Checking the domain field after modifying the reference count would probably be okay really, it's just that a domain could get a handle on another domain's page for a short while without that other domain's permission.
-- Keir