|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 7/8] x86/mm: handle foreign mappings in p2m_entry_modify
>>> On 07.02.19 at 17:53, <roger.pau@xxxxxxxxxx> wrote:
> On Wed, Feb 06, 2019 at 09:59:30AM -0700, Jan Beulich wrote:
>> >>> On 30.01.19 at 11:36, <roger.pau@xxxxxxxxxx> wrote:
>> > --- a/xen/include/asm-x86/p2m.h
>> > +++ b/xen/include/asm-x86/p2m.h
>> > @@ -933,9 +933,12 @@ struct hvm_ioreq_server *p2m_get_ioreq_server(struct
>> > domain *d,
>> > unsigned int *flags);
>> >
>> > static inline void p2m_entry_modify(struct p2m_domain *p2m, p2m_type_t nt,
>> > - p2m_type_t ot, unsigned int level)
>> > + p2m_type_t ot, mfn_t nfn, mfn_t ofn,
>> > + unsigned int level)
>> > {
>> > - if ( level != 1 || nt == ot )
>> > + struct page_info *pg;
>> > +
>> > + if ( level != 1 || (nt == ot && mfn_eq(nfn, ofn)) )
>> > return;
>> >
>> > switch ( nt )
>> > @@ -948,6 +951,17 @@ static inline void p2m_entry_modify(struct p2m_domain
>> > *p2m, p2m_type_t nt,
>> > p2m->ioreq.entry_count++;
>> > break;
>> >
>> > + case p2m_map_foreign:
>> > + pg = mfn_to_page(nfn);
>> > +
>> > + if ( !pg || !page_get_owner_and_reference(pg) )
>>
>> mfn_to_page() can't return NULL, can it? You may want to ASSERT()
>> beforehand that the MFN is not INVALID_MFN, though.
>
> I've added ASSERT(mfn_valid(mfn)) and the same below. I think it's
> safer to use mfn_valid rather that only checking against INVALID_MFM.
Thanks, indeed I too did consider this afterwards.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |