From: Julien Grall <julien.grall@linaro.org>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: stefano.stabellini@eu.citrix.com, tim@xen.org, xen-devel@lists.xen.org
Subject: Re: [PATCH v2 7/8] xen: arm: use superpages in p2m when pages are suitably aligned
Date: Thu, 12 Jun 2014 10:00:28 +0100 [thread overview]
Message-ID: <53996C2C.4000900@linaro.org> (raw)
In-Reply-To: <1402558252.31087.63.camel@dagon.hellion.org.uk>
On 12/06/14 08:30, Ian Campbell wrote:
> On Wed, 2014-06-11 at 23:19 +0100, Julien Grall wrote:
>> Hi Ian,
>>
>> While I was looking closer to this patch I found something strange. Why
>> all the callers of guest_physmap_add_page in the directory common don't
>> check that the function success to create the mapping?
>
> "directory common"? I don't get your meaning.
Sorry, I meant xen/common/
>>> + return P2M_ONE_PROGRESS;
>>> + }
>>> + else if ( level == 3 )
>>> + return -ENOMEM;
>>> + }
>>> +
>>> + BUG_ON(level == 3); /* L3 is always superpage aligned */
>>
>> Did you mean page-aligned?
>
> What I meant was that an L3 entry is always "superpage aligned" because
> it is the smallest possible element. Since I wrote that I renamed my
> is_superpage_aligned function to is_mapping_aligned. I should perhaps
> update this comment to reflect that, which would make it clearer.
Oh ok. In my mind, L3 is using page alignment not superpage alignment. I
think was confuse because in your cover letter you define superpage as
2M or 1G mappings.
>> [..]
>>
>>> + case INSERT:
>>> + if ( is_mapping_aligned(*addr, end_gpaddr, *maddr, level_size) &&
>>> + /* We do not handle replacing an existing table with a superpage */
>>> + (level == 3 || !p2m_table(orig_pte)) )
>>> + {
>>> + /* New mapping is superpage aligned, make it */
>>> + pte = mfn_to_p2m_entry(*maddr >> PAGE_SHIFT, mattr, t);
>>> + if ( level < 3 )
>>
>> It's funny, sometimes you use level < 3 and some level != 3 (see in
>> ALLOCATE).
>
> True.
>
>> I think this pte.p2m.table set can be handled directly in
>> mfn_to_p2m_entry. This will avoid duplicating code.
>
> It can't because mfn_to_p2m_entry is used to create both table and
> mapping style entries.
There is only on call where we don't override the pte.p2m.table bit (the
one at the end of p2m_create table).
I would move this extra test in the mfn_to_p2m_entry and override only
for this specific case.
>> [..]
>>
>>> + }
>>> + else
>>> + {
>>> + /* New mapping is not superpage aligned, create a new table entry */
>>> + BUG_ON(level == 3); /* L3 is always superpage aligned */
>>
>> Did you mean page-aligned?
>>
>> [..]
>>
>>> - /* Got the next page */
>>> - addr += PAGE_SIZE;
>>> + rc = apply_one_level(d, &third[third_table_offset(addr)],
>>> + 3, flush_pt, op,
>>> + start_gpaddr, end_gpaddr,
>>> + &addr, &maddr, &flush,
>>> + mattr, t);
>>> + if ( rc < 0 ) goto out;
>>
>> Shall we redo the whole range if the mapping has failed here?
>
> s/redo/undo/?
Undo sorry.
Regards,
--
Julien Grall
next prev parent reply other threads:[~2014-06-12 9:00 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-11 16:37 [PATCH v2 0/8] xen: arm: Use super pages in p2m Ian Campbell
2014-06-11 16:39 ` [PATCH v2 1/8] xen: arm: dump vcpu gic info in arch_dump_vcpu_info Ian Campbell
2014-06-11 16:39 ` [PATCH v2 2/8] tools/libxc: pull min/max_t into xc_private.h Ian Campbell
2014-06-11 21:14 ` Julien Grall
2014-06-11 16:39 ` [PATCH v2 3/8] tools: arm: allocate large pages to guests Ian Campbell
2014-06-11 21:26 ` Julien Grall
2014-06-12 7:19 ` Ian Campbell
2014-06-12 8:47 ` Julien Grall
2014-06-11 16:40 ` [PATCH v2 4/8] xen: arm: only put_page for p2m operations which require it Ian Campbell
2014-06-11 21:31 ` Julien Grall
2014-06-12 7:27 ` Ian Campbell
2014-06-11 16:40 ` [PATCH v2 5/8] xen: arm: handle superpage mappings in p2m_lookup Ian Campbell
2014-06-11 16:40 ` [PATCH v2 6/8] xen: arm: add some helpers for assessing p2m pte Ian Campbell
2014-06-11 21:39 ` Julien Grall
2014-06-12 7:27 ` Ian Campbell
2014-06-11 16:40 ` [PATCH v2 7/8] xen: arm: use superpages in p2m when pages are suitably aligned Ian Campbell
2014-06-11 22:19 ` Julien Grall
2014-06-12 7:30 ` Ian Campbell
2014-06-12 9:00 ` Julien Grall [this message]
2014-06-13 14:08 ` Ian Campbell
2014-06-13 17:45 ` Julien Grall
2014-06-16 8:26 ` Jan Beulich
2014-06-16 9:53 ` Ian Campbell
2014-06-12 13:57 ` Stefano Stabellini
2014-06-13 14:15 ` Ian Campbell
2014-06-11 16:40 ` [PATCH v2 8/8] xen: arm: allocate more than one bank for 1:1 domain 0 if needed Ian Campbell
2014-06-11 22:47 ` Julien Grall
2014-06-12 7:31 ` Ian Campbell
2014-06-17 17:58 ` Julien Grall
2014-06-18 8:27 ` Ian Campbell
2014-06-18 9:10 ` Julien Grall
2014-06-18 9:36 ` Ian Campbell
2014-06-12 7:20 ` [PATCH v2 0/8] xen: arm: Use super pages in p2m Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53996C2C.4000900@linaro.org \
--to=julien.grall@linaro.org \
--cc=Ian.Campbell@citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.