All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tamas K Lengyel <tamas.lengyel@zentific.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: "Tian, Kevin" <kevin.tian@intel.com>,
	"wei.liu2@citrix.com" <wei.liu2@citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Tim Deegan <tim@xen.org>, Steven Maresca <steve@zentific.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
	Jan Beulich <jbeulich@suse.com>,
	"Dong, Eddie" <eddie.dong@intel.com>,
	Andres Lagar-Cavilla <andres@lagarcavilla.org>,
	Jun Nakajima <jun.nakajima@intel.com>,
	"rshriram@cs.ubc.ca" <rshriram@cs.ubc.ca>,
	Keir Fraser <keir@xen.org>,
	Daniel De Graaf <dgdegra@tycho.nsa.gov>,
	"yanghy@cn.fujitsu.com" <yanghy@cn.fujitsu.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>
Subject: Re: [PATCH V5 03/12] xen/mem_paging: Convert mem_event_op to mem_paging_op
Date: Fri, 13 Feb 2015 19:30:30 +0100	[thread overview]
Message-ID: <CAErYnshNYWmmOZioWqt=MxQGxu0EGDB-VcEOHQE6=Pb-bG8tyA@mail.gmail.com> (raw)
In-Reply-To: <54DE3FCE.4070300@citrix.com>

On Fri, Feb 13, 2015 at 7:17 PM, Andrew Cooper
<andrew.cooper3@citrix.com> wrote:
> On 13/02/15 16:33, Tamas K Lengyel wrote:
>> The only use-case of the mem_event_op structure had been in mem_paging,
>> thus renaming the structure mem_paging_op and relocating its associated
>> functions clarifies its actual usage.
>>
>> Signed-off-by: Tamas K Lengyel <tamas.lengyel@zentific.com>
>> Acked-by: Tim Deegan <tim@xen.org>
>> Acked-by: Ian Campbell <ian.campbell@citrix.com>
>> Acked-by: Jan Beulich <jbeulich@suse.com>
>> ---
>> v5: Style fixes
>> v4: Style fixes
>> v3: Style fixes
>> ---
>>  tools/libxc/xc_mem_event.c       | 16 ----------------
>>  tools/libxc/xc_mem_paging.c      | 26 ++++++++++++++++++--------
>>  tools/libxc/xc_private.h         |  3 ---
>>  xen/arch/x86/mm/mem_paging.c     | 32 +++++++++++++-------------------
>>  xen/arch/x86/x86_64/compat/mm.c  | 10 ++++++----
>>  xen/arch/x86/x86_64/mm.c         |  8 ++++----
>>  xen/common/mem_event.c           |  4 ++--
>>  xen/include/asm-x86/mem_paging.h |  2 +-
>>  xen/include/public/memory.h      |  9 ++++-----
>>  9 files changed, 48 insertions(+), 62 deletions(-)
>>
>> diff --git a/tools/libxc/xc_mem_event.c b/tools/libxc/xc_mem_event.c
>> index ee25cdd..487fcee 100644
>> --- a/tools/libxc/xc_mem_event.c
>> +++ b/tools/libxc/xc_mem_event.c
>> @@ -40,22 +40,6 @@ int xc_mem_event_control(xc_interface *xch, domid_t domain_id, unsigned int op,
>>      return rc;
>>  }
>>
>> -int xc_mem_event_memop(xc_interface *xch, domid_t domain_id,
>> -                        unsigned int op, unsigned int mode,
>> -                        uint32_t gfn, void *buffer)
>> -{
>> -    xen_mem_event_op_t meo;
>> -
>> -    memset(&meo, 0, sizeof(meo));
>> -
>> -    meo.op      = op;
>> -    meo.domain  = domain_id;
>> -    meo.gfn     = gfn;
>> -    meo.buffer  = (unsigned long) buffer;
>> -
>> -    return do_memory_op(xch, mode, &meo, sizeof(meo));
>> -}
>> -
>>  void *xc_mem_event_enable(xc_interface *xch, domid_t domain_id, int param,
>>                            uint32_t *port, int enable_introspection)
>>  {
>> diff --git a/tools/libxc/xc_mem_paging.c b/tools/libxc/xc_mem_paging.c
>> index 5194423..049aff4 100644
>> --- a/tools/libxc/xc_mem_paging.c
>> +++ b/tools/libxc/xc_mem_paging.c
>> @@ -23,6 +23,20 @@
>>
>>  #include "xc_private.h"
>>
>> +static int xc_mem_paging_memop(xc_interface *xch, domid_t domain_id,
>> +                               unsigned int op, uint32_t gfn, void *buffer)
>
> As said in patch 1, this gfn must be a uint64_t
>
>> +{
>> +    xen_mem_paging_op_t mpo;
>> +
>> +    memset(&mpo, 0, sizeof(mpo));
>> +
>> +    mpo.op      = op;
>> +    mpo.domain  = domain_id;
>> +    mpo.gfn     = gfn;
>> +    mpo.buffer  = (unsigned long) buffer;
>> +
>> +    return do_memory_op(xch, XENMEM_paging_op, &mpo, sizeof(mpo));
>> +}
>>
>>  int xc_mem_paging_enable(xc_interface *xch, domid_t domain_id,
>>                           uint32_t *port)
>> @@ -49,25 +63,22 @@ int xc_mem_paging_disable(xc_interface *xch, domid_t domain_id)
>>
>>  int xc_mem_paging_nominate(xc_interface *xch, domid_t domain_id, unsigned long gfn)
>>  {
>
> And these 'unsigned long gfn' should be promoted to a uint64_t gfn to
> avoid truncation in 32bit toolstacks.
>
> Whether you wish to fix this in the same patch, or fix it in a separate
> "make mem_event interface 64/32bit safe" patch is up to you.  This is
> straying somewhat form a simple refactoring of mem_event_op to
> mem_paging_op.

I'll just do it here for the sake of juggling fewer patches.

>
>> -    return xc_mem_event_memop(xch, domain_id,
>> +    return xc_mem_paging_memop(xch, domain_id,
>>                                  XENMEM_paging_op_nominate,
>> -                                XENMEM_paging_op,
>>                                  gfn, NULL);
>>  }
>>
>>  int xc_mem_paging_evict(xc_interface *xch, domid_t domain_id, unsigned long gfn)
>>  {
>> -    return xc_mem_event_memop(xch, domain_id,
>> +    return xc_mem_paging_memop(xch, domain_id,
>>                                  XENMEM_paging_op_evict,
>> -                                XENMEM_paging_op,
>>                                  gfn, NULL);
>>  }
>>
>>  int xc_mem_paging_prep(xc_interface *xch, domid_t domain_id, unsigned long gfn)
>>  {
>> -    return xc_mem_event_memop(xch, domain_id,
>> +    return xc_mem_paging_memop(xch, domain_id,
>>                                  XENMEM_paging_op_prep,
>> -                                XENMEM_paging_op,
>>                                  gfn, NULL);
>>  }
>>
>> @@ -87,9 +98,8 @@ int xc_mem_paging_load(xc_interface *xch, domid_t domain_id,
>>      if ( mlock(buffer, XC_PAGE_SIZE) )
>>          return -1;
>>
>> -    rc = xc_mem_event_memop(xch, domain_id,
>> +    rc = xc_mem_paging_memop(xch, domain_id,
>>                                  XENMEM_paging_op_prep,
>> -                                XENMEM_paging_op,
>>                                  gfn, buffer);
>>
>>      old_errno = errno;
>> diff --git a/xen/include/asm-x86/mem_paging.h b/xen/include/asm-x86/mem_paging.h
>> index 6b7a1fe..92ed2fa 100644
>> --- a/xen/include/asm-x86/mem_paging.h
>> +++ b/xen/include/asm-x86/mem_paging.h
>> @@ -21,7 +21,7 @@
>>   */
>>
>>
>> -int mem_paging_memop(struct domain *d, xen_mem_event_op_t *meo);
>> +int mem_paging_memop(struct domain *d, xen_mem_paging_op_t *meo);
>
> s/meo/mpo/ like the implementation.

Ack. This header also seems to have been missing an #ifdef wrapper so
I'm going to add that here as well.

Tamas

>
> Once fixed, Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
>

  reply	other threads:[~2015-02-13 18:30 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-13 16:33 [PATCH V5 00/12] xen: Clean-up of mem_event subsystem Tamas K Lengyel
2015-02-13 16:33 ` [PATCH V5 01/12] xen/mem_event: Cleanup of mem_event structures Tamas K Lengyel
2015-02-13 17:23   ` Andrew Cooper
2015-02-13 18:03     ` Tamas K Lengyel
2015-02-13 18:09       ` Andrew Cooper
2015-02-13 18:13         ` Tamas K Lengyel
2015-02-17 11:48         ` Jan Beulich
2015-02-13 16:33 ` [PATCH V5 02/12] xen/mem_event: Cleanup mem_event ring names and domctls Tamas K Lengyel
2015-02-13 17:53   ` Andrew Cooper
2015-02-13 18:06     ` Tamas K Lengyel
2015-02-13 16:33 ` [PATCH V5 03/12] xen/mem_paging: Convert mem_event_op to mem_paging_op Tamas K Lengyel
2015-02-13 18:17   ` Andrew Cooper
2015-02-13 18:30     ` Tamas K Lengyel [this message]
2015-02-13 16:33 ` [PATCH V5 04/12] xen: Rename mem_event to vm_event Tamas K Lengyel
2015-02-13 18:31   ` Andrew Cooper
2015-02-13 16:33 ` [PATCH V5 05/12] tools/tests: Clean-up tools/tests/xen-access Tamas K Lengyel
2015-02-13 16:33 ` [PATCH V5 06/12] x86/hvm: factor out and rename vm_event related functions Tamas K Lengyel
2015-02-13 18:41   ` Andrew Cooper
2015-02-17 11:56   ` Jan Beulich
2015-02-17 17:37     ` Tamas K Lengyel
2015-02-18  9:07       ` Jan Beulich
2015-02-18 12:09         ` Tamas K Lengyel
2015-02-13 16:33 ` [PATCH V5 07/12] xen: Introduce monitor_op domctl Tamas K Lengyel
2015-02-13 20:09   ` Andrew Cooper
2015-02-17 14:02   ` Jan Beulich
2015-02-17 18:20     ` Tamas K Lengyel
2015-02-17 18:37       ` Andrew Cooper
2015-02-17 18:48         ` Tamas K Lengyel
2015-02-17 22:59       ` Tamas K Lengyel
2015-02-18  9:26       ` Jan Beulich
2015-02-18 12:11         ` Tamas K Lengyel
2015-02-13 16:33 ` [PATCH V5 08/12] xen/vm_event: Check for VM_EVENT_FLAG_DUMMY only in Debug builds Tamas K Lengyel
2015-02-13 20:14   ` Andrew Cooper
2015-02-13 22:48     ` Tamas K Lengyel
2015-02-13 22:53       ` Tamas K Lengyel
2015-02-13 23:00         ` Andrew Cooper
2015-02-13 23:02           ` Tamas K Lengyel
2015-02-13 16:33 ` [PATCH V5 09/12] xen/vm_event: Decouple vm_event and mem_access Tamas K Lengyel
2015-02-13 21:05   ` Andrew Cooper
2015-02-13 23:00     ` Tamas K Lengyel
2015-02-17 14:17   ` Jan Beulich
2015-02-17 18:30     ` Tamas K Lengyel
2015-02-17 18:34       ` Andrew Cooper
2015-02-17 18:49         ` Tamas K Lengyel
2015-02-13 16:33 ` [PATCH V5 10/12] xen/vm_event: Relocate memop checks Tamas K Lengyel
2015-02-13 21:23   ` Andrew Cooper
2015-02-13 23:20     ` Tamas K Lengyel
2015-02-13 23:24       ` Tamas K Lengyel
2015-02-17 14:25   ` Jan Beulich
2015-02-17 18:47     ` Tamas K Lengyel
2015-02-18  9:29       ` Jan Beulich
2015-02-18 12:13         ` Tamas K Lengyel
2015-02-13 16:33 ` [PATCH V5 11/12] xen/xsm: Split vm_event_op into three separate labels Tamas K Lengyel
2015-02-13 21:25   ` Andrew Cooper
2015-02-13 16:33 ` [PATCH V5 12/12] xen/vm_event: Add RESUME option to vm_event_op domctl Tamas K Lengyel
2015-02-13 21:44   ` Andrew Cooper
2015-02-13 23:10     ` Tamas K Lengyel
2015-02-17 14:31   ` Jan Beulich
2015-02-17 18:32     ` Tamas K Lengyel
2015-02-18  9:31       ` Jan Beulich
2015-02-18 12:18         ` Tamas K Lengyel

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='CAErYnshNYWmmOZioWqt=MxQGxu0EGDB-VcEOHQE6=Pb-bG8tyA@mail.gmail.com' \
    --to=tamas.lengyel@zentific.com \
    --cc=andres@lagarcavilla.org \
    --cc=andrew.cooper3@citrix.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=eddie.dong@intel.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=jun.nakajima@intel.com \
    --cc=keir@xen.org \
    --cc=kevin.tian@intel.com \
    --cc=rshriram@cs.ubc.ca \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=steve@zentific.com \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    --cc=yanghy@cn.fujitsu.com \
    /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.