From: "Xia, Hongyan" <hongyxia@amazon.com>
To: "pdurrant@amzn.com" <pdurrant@amzn.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "sstabellini@kernel.org" <sstabellini@kernel.org>,
"julien@xen.org" <julien@xen.org>, "wl@xen.org" <wl@xen.org>,
"konrad.wilk@oracle.com" <konrad.wilk@oracle.com>,
"andrew.cooper3@citrix.com" <andrew.cooper3@citrix.com>,
"ian.jackson@eu.citrix.com" <ian.jackson@eu.citrix.com>,
"george.dunlap@citrix.com" <george.dunlap@citrix.com>,
"Durrant, Paul" <pdurrant@amazon.co.uk>,
"jbeulich@suse.com" <jbeulich@suse.com>,
"Volodymyr_Babchuk@epam.com" <Volodymyr_Babchuk@epam.com>,
"roger.pau@citrix.com" <roger.pau@citrix.com>
Subject: Re: [Xen-devel] [PATCH v3 1/6] domain: introduce alloc/free_shared_info() helpers...
Date: Thu, 5 Mar 2020 13:23:23 +0000 [thread overview]
Message-ID: <02cbae7ef896e59eecbe89cbf898142a49c8e191.camel@amazon.com> (raw)
In-Reply-To: <20200305124504.3564-2-pdurrant@amzn.com>
On Thu, 2020-03-05 at 12:44 +0000, pdurrant@amzn.com wrote:
> From: Paul Durrant <pdurrant@amazon.com>
>
> ... and save the MFN.
>
> This patch modifies the 'shared_info' field of struct domain to be
> a structure comprising an MFN and a virtual address. Allocations are
> still done from xenheap, so the virtual address still equates to
> virt_to_mfn() called on the MFN but subsequent patch will change
> this.
> Hence the need to save the MFN.
>
> NOTE: Whist defining the new helpers, virt_to_mfn() in
> common/domain.c
> is made type safe.
> The definition of nmi_reason() in asm-x86/shared.h is also re-
> flowed to avoid overly long lines.
>
> Signed-off-by: Paul Durrant <pdurrant@amazon.com>
> Reviewed-by: Julien Grall <julien@xen.org>
> ...
>
> +int alloc_shared_info(struct domain *d, unsigned int memflags)
> +{
> + if ( (d->shared_info.virt = alloc_xenheap_pages(0, memflags)) ==
> NULL )
> + return -ENOMEM;
> +
> + d->shared_info.mfn = virt_to_mfn(d->shared_info.virt);
> +
> + clear_page(d->shared_info.virt);
> + share_xen_page_with_guest(mfn_to_page(d->shared_info.mfn), d,
> SHARE_rw);
> +
> + return 0;
> +}
> +
> +void free_shared_info(struct domain *d)
> +{
> + if ( !d->shared_info.virt )
> + return;
> +
> + free_xenheap_page(d->shared_info.virt);
> + d->shared_info.virt = NULL;
> +}
> +
I was going to say that free_xenheap_page() can deal with NULL so we do
not have to return on NULL. But then I found that the final patch needs
to unmap it which cannot deal with NULL anyway, so I no longer have a
strong opinion to do clean-ups here.
Other than that,
Reviewed-by: Hongyan Xia <hongyxia@amazon.org>
Hongyan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2020-03-05 13:24 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-05 12:44 [Xen-devel] [PATCH v3 0/6] remove one more shared xenheap page: shared_info pdurrant
2020-03-05 12:44 ` [Xen-devel] [PATCH v3 1/6] domain: introduce alloc/free_shared_info() helpers pdurrant
2020-03-05 13:23 ` Xia, Hongyan [this message]
2020-03-05 13:25 ` Xia, Hongyan
2020-03-06 11:41 ` Jan Beulich
2020-03-05 12:45 ` [Xen-devel] [PATCH v3 2/6] x86 / p2m: remove page_list check in p2m_alloc_table pdurrant
2020-03-06 11:45 ` Jan Beulich
2020-03-06 12:07 ` Durrant, Paul
2020-03-06 12:46 ` Jan Beulich
2020-03-06 12:50 ` Durrant, Paul
2020-03-06 13:06 ` Jan Beulich
2020-03-06 13:11 ` [Xen-devel] [EXTERNAL][PATCH " Paul Durrant
2020-03-06 13:19 ` Jan Beulich
2020-03-06 13:25 ` Paul Durrant
2020-03-05 12:45 ` [Xen-devel] [PATCH v3 3/6] x86 / pv: do not treat PGC_extra pages as RAM when constructing dom0 pdurrant
2020-03-06 11:56 ` Jan Beulich
2020-03-06 12:03 ` Durrant, Paul
2020-03-06 13:39 ` Jan Beulich
2020-03-06 13:45 ` Paul Durrant
2020-03-06 13:47 ` Jan Beulich
2020-03-05 12:45 ` [Xen-devel] [PATCH v3 4/6] x86 / ioreq: use a MEMF_no_refcount allocation for server pages pdurrant
2020-03-06 12:03 ` Jan Beulich
2020-03-05 12:45 ` [Xen-devel] [PATCH v3 5/6] mm: add 'is_special_page' macro pdurrant
2020-03-05 15:09 ` Tamas K Lengyel
2020-03-05 15:38 ` Durrant, Paul
2020-03-05 15:58 ` Tamas K Lengyel
2020-03-06 7:02 ` Alan Robinson
2020-03-06 9:22 ` Durrant, Paul
2020-03-06 12:20 ` Jan Beulich
2020-03-06 12:35 ` Paul Durrant
2020-03-06 13:44 ` Jan Beulich
2020-03-06 13:48 ` Paul Durrant
2020-03-06 13:52 ` Jan Beulich
2020-03-06 13:57 ` Paul Durrant
2020-03-06 14:26 ` Julien Grall
2020-03-06 14:50 ` Jan Beulich
2020-03-05 12:45 ` [Xen-devel] [PATCH v3 6/6] domain: use PGC_extra domheap page for shared_info pdurrant
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=02cbae7ef896e59eecbe89cbf898142a49c8e191.camel@amazon.com \
--to=hongyxia@amazon.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=andrew.cooper3@citrix.com \
--cc=george.dunlap@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=konrad.wilk@oracle.com \
--cc=pdurrant@amazon.co.uk \
--cc=pdurrant@amzn.com \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.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.