All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@citrix.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Xen Devel <xen-devel@lists.xen.org>
Subject: Re: [RFC 2/6] linux-stubdomain: Compile Linux
Date: Mon, 22 Apr 2013 14:46:29 +0100	[thread overview]
Message-ID: <51753F35.3000507@citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1304191117310.7254@kaball.uk.xensource.com>

On 19/04/13 11:33, Stefano Stabellini wrote:
> On Wed, 17 Apr 2013, Anthony PERARD wrote:
>> diff --git a/stubdom-linux/0001-xen-Don-t-check-for-xen_initial_domain-in-privcmd_io.patch b/stubdom-linux/0001-xen-Don-t-check-for-xen_initial_domain-in-privcmd_io.patch
>> new file mode 100644
>> index 0000000..627b337
>> --- /dev/null
>> +++ b/stubdom-linux/0001-xen-Don-t-check-for-xen_initial_domain-in-privcmd_io.patch
>> @@ -0,0 +1,39 @@
>> +From 94d3502e70882a78ec3abb22379a79afc1292fb0 Mon Sep 17 00:00:00 2001
>> +From: Anthony PERARD <anthony.perard@citrix.com>
>> +Date: Fri, 1 Jun 2012 15:46:39 +0100
>> +Subject: [PATCH 1/2] xen: Don't check for xen_initial_domain in
>> + privcmd_ioctl_mmap*.
>> +
>> +This prevent a stubdom from working.
>> +
>> +---
>> + drivers/xen/privcmd.c | 6 ------
>> + 1 file changed, 6 deletions(-)
>> +
>> +diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c
>> +index ccee0f1..a8d71a3 100644
>> +--- a/drivers/xen/privcmd.c
>> ++++ b/drivers/xen/privcmd.c
>> +@@ -196,9 +196,6 @@ static long privcmd_ioctl_mmap(void __user *udata)
>> +       LIST_HEAD(pagelist);
>> +       struct mmap_mfn_state state;
>> +
>> +-      if (!xen_initial_domain())
>> +-              return -EPERM;
>> +-
>> +       if (copy_from_user(&mmapcmd, udata, sizeof(mmapcmd)))
>> +               return -EFAULT;
>> +
>> +@@ -286,9 +283,6 @@ static long privcmd_ioctl_mmap_batch(void __user *udata)
>> +       LIST_HEAD(pagelist);
>> +       struct mmap_batch_state state;
>> +
>> +-      if (!xen_initial_domain())
>> +-              return -EPERM;
>> +-
>> +       if (copy_from_user(&m, udata, sizeof(m)))
>> +               return -EFAULT;
>> +
> 
> 
> I think you should submit both patches separately for inclusion in the
> Linux kernel.

Definitely.
Should we remove the check for initial_domain all together and leave
this permission to be handle by Xen? Or should we try to find out if the
function is called in a stubdom/dom0 ?

>> +Anthony PERARD
>> +
>> diff --git a/stubdom-linux/0002-fix-remap_area_mfn_pte_fn.patch b/stubdom-linux/0002-fix-remap_area_mfn_pte_fn.patch
>> new file mode 100644
>> index 0000000..0d5c262
>> --- /dev/null
>> +++ b/stubdom-linux/0002-fix-remap_area_mfn_pte_fn.patch
>> @@ -0,0 +1,36 @@
>> +From 61cd574f29f41046f1c709cfa9da118156babf83 Mon Sep 17 00:00:00 2001
>> +From: Anthony PERARD <anthony.perard@citrix.com>
>> +Date: Fri, 1 Jun 2012 15:47:01 +0100
>> +Subject: [PATCH 2/2] fix/remap_area_mfn_pte_fn
> 
> I think we need a better commit message

Yes, this is definitely not a patch title/comment.

>> +---
>> + arch/x86/xen/mmu.c | 13 ++++++++++++-
>> + 1 file changed, 12 insertions(+), 1 deletion(-)
>> +
>> +diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
>> +index 69f5857..999fc82 100644
>> +--- a/arch/x86/xen/mmu.c
>> ++++ b/arch/x86/xen/mmu.c
>> +@@ -2315,7 +2315,18 @@ static int remap_area_mfn_pte_fn(pte_t *ptep, pgtable_t token,
>> +                                unsigned long addr, void *data)
>> + {
>> +       struct remap_data *rmd = data;
>> +-      pte_t pte = pte_mkspecial(pfn_pte(rmd->mfn++, rmd->prot));
>> ++
>> ++        /* Use the native_make_pte function because we are sure we don't
>> ++         * have to do any pfn->mfn translations but at the same time we
>> ++         * could in a stubdom so xen_initial_domain() would return false. */
>> ++        pte_t pte = pte_mkspecial(native_make_pte(((phys_addr_t)(rmd->mfn++) << PAGE_SHIFT)
>> ++                                                  | massage_pgprot(rmd->prot)));
> 
> This change is OK. The stubdom part of the comment is a bit confusing
> and would benefit from a clearer explanation.

OK, I try to clean the explanation.

> Also the indentation is wrong.
> 
> 
>> ++        pteval_t val = pte_val_ma(pte);
>> ++
>> ++        if (pat_enabled && !WARN_ON(val & _PAGE_PAT)) {
>> ++            if ((val & (_PAGE_PCD | _PAGE_PWT)) == _PAGE_PWT)
>> ++                val = (val & ~(_PAGE_PCD | _PAGE_PWT)) | _PAGE_PAT;
>> ++        }
> 
> Konrad disabled PAT in upstream kernels, see:
> 
> commit 8eaffa67b43e99ae581622c5133e20b0f48bcef1
> Author: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Date:   Fri Feb 10 09:16:27 2012 -0500
> 
>     xen/pat: Disable PAT support for now.
> 


-- 
Anthony PERARD

  reply	other threads:[~2013-04-22 13:46 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-17 19:09 [RFC 0/6] RFC Linux based stub-domain Anthony PERARD
2013-04-17 19:09 ` [RFC 1/6] linux-stubdomain: Compile QEMU Anthony PERARD
2013-04-17 19:09 ` [RFC 2/6] linux-stubdomain: Compile Linux Anthony PERARD
2013-04-19 10:33   ` Stefano Stabellini
2013-04-22 13:46     ` Anthony PERARD [this message]
2013-04-22 13:59       ` Daniel De Graaf
2013-04-22 14:09       ` Samuel Thibault
2013-04-17 19:09 ` [RFC 3/6] linux-stubdomain: Build a disk image Anthony PERARD
2013-04-19  9:26   ` Ian Campbell
2013-04-19 11:58     ` Anthony PERARD
2013-04-19 12:08       ` Ian Campbell
2013-04-19 13:53         ` Samuel Thibault
2013-04-17 19:09 ` [RFC 4/6] libxl: Add "stubdomain_version" to domain_build_info Anthony PERARD
2013-04-19  9:29   ` Ian Campbell
2013-04-22 13:31     ` Anthony PERARD
2013-04-22 14:36       ` Ian Campbell
2013-04-17 19:09 ` [RFC 5/6] libxl: Handle Linux stubdomain specifique QEMU option Anthony PERARD
2013-04-19  9:31   ` Ian Campbell
2013-04-22 13:37     ` Anthony PERARD
2013-04-17 19:09 ` [RFC 6/6] libxl: Build the domain with a Linux based stubdomain Anthony PERARD
2013-04-19  9:17 ` [RFC 0/6] RFC Linux based stub-domain Ian Campbell
2013-04-19 11:11   ` Anthony PERARD
2013-04-19 12:04 ` David Vrabel

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=51753F35.3000507@citrix.com \
    --to=anthony.perard@citrix.com \
    --cc=konrad.wilk@oracle.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --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.