From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Bob Liu <lliubbo@gmail.com>, Keir Fraser <keir@xen.org>
Cc: james.harper@bendigoit.com.au, ian.campbell@citrix.com,
andrew.cooper3@citrix.com, JBeulich@suse.com,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v4 11/15] tmem: cleanup: drop useless functions from head file
Date: Fri, 13 Dec 2013 11:44:05 -0500 [thread overview]
Message-ID: <20131213164405.GA11305@phenom.dumpdata.com> (raw)
In-Reply-To: <1386846315-13299-12-git-send-email-bob.liu@oracle.com>
On Thu, Dec 12, 2013 at 07:05:11PM +0800, Bob Liu wrote:
> They are several one line functions in tmem_xen.h which are useless, this patch
> embeded them into tmem.c directly.
> Also modify void *tmem in struct domain to struct client *tmem_client in order
> to make things more straightforward.
>
> Signed-off-by: Bob Liu <bob.liu@oracle.com>
> ---
> xen/common/domain.c | 4 ++--
> xen/common/tmem.c | 24 ++++++++++++------------
> xen/include/xen/sched.h | 2 +-
> xen/include/xen/tmem_xen.h | 30 +-----------------------------
Keir, are you OK with this simple name change?
Thanks!
> 4 files changed, 16 insertions(+), 44 deletions(-)
>
> diff --git a/xen/common/domain.c b/xen/common/domain.c
> index 2cbc489..2636fc9 100644
> --- a/xen/common/domain.c
> +++ b/xen/common/domain.c
> @@ -528,9 +528,9 @@ int domain_kill(struct domain *d)
> spin_barrier(&d->domain_lock);
> evtchn_destroy(d);
> gnttab_release_mappings(d);
> - tmem_destroy(d->tmem);
> + tmem_destroy(d->tmem_client);
> domain_set_outstanding_pages(d, 0);
> - d->tmem = NULL;
> + d->tmem_client = NULL;
> /* fallthrough */
> case DOMDYING_dying:
> rc = domain_relinquish_resources(d);
> diff --git a/xen/common/tmem.c b/xen/common/tmem.c
> index 5bf5f04..2659651 100644
> --- a/xen/common/tmem.c
> +++ b/xen/common/tmem.c
> @@ -1206,7 +1206,7 @@ static struct client *client_create(domid_t cli_id)
> goto fail;
> }
> if ( !d->is_dying ) {
> - d->tmem = client;
> + d->tmem_client = client;
> client->domain = d;
> }
> rcu_unlock_domain(d);
> @@ -1324,7 +1324,7 @@ obj_unlock:
>
> static int tmem_evict(void)
> {
> - struct client *client = tmem_client_from_current();
> + struct client *client = current->domain->tmem_client;
> struct tmem_page_descriptor *pgp = NULL, *pgp2, *pgp_del;
> struct tmem_object_root *obj;
> struct tmem_pool *pool;
> @@ -1761,7 +1761,7 @@ static int do_tmem_get(struct tmem_pool *pool, struct oid *oidp, uint32_t index,
> list_del(&pgp->us.client_eph_pages);
> list_add_tail(&pgp->us.client_eph_pages,&client->ephemeral_page_list);
> spin_unlock(&eph_lists_spinlock);
> - obj->last_client = tmem_get_cli_id_from_current();
> + obj->last_client = current->domain->domain_id;
> }
> }
> if ( obj != NULL )
> @@ -1836,7 +1836,7 @@ out:
>
> static int do_tmem_destroy_pool(uint32_t pool_id)
> {
> - struct client *client = tmem_client_from_current();
> + struct client *client = current->domain->tmem_client;
> struct tmem_pool *pool;
>
> if ( client->pools == NULL )
> @@ -1867,7 +1867,7 @@ static int do_tmem_new_pool(domid_t this_cli_id,
> int i;
>
> if ( this_cli_id == TMEM_CLI_ID_NULL )
> - cli_id = tmem_get_cli_id_from_current();
> + cli_id = current->domain->domain_id;
> else
> cli_id = this_cli_id;
> tmem_client_info("tmem: allocating %s-%s tmem pool for %s=%d...",
> @@ -1908,7 +1908,7 @@ static int do_tmem_new_pool(domid_t this_cli_id,
> }
> else
> {
> - client = tmem_client_from_current();
> + client = current->domain->tmem_client;
> ASSERT(client != NULL);
> for ( d_poolid = 0; d_poolid < MAX_POOLS_PER_DOMAIN; d_poolid++ )
> if ( client->pools[d_poolid] == NULL )
> @@ -2511,7 +2511,7 @@ static int do_tmem_control(struct tmem_op *op)
> uint32_t subop = op->u.ctrl.subop;
> struct oid *oidp = (struct oid *)(&op->u.ctrl.oid[0]);
>
> - if (!tmem_current_is_privileged())
> + if ( xsm_tmem_control(XSM_PRIV) )
> return -EPERM;
>
> switch(subop)
> @@ -2583,7 +2583,7 @@ static int do_tmem_control(struct tmem_op *op)
> long do_tmem_op(tmem_cli_op_t uops)
> {
> struct tmem_op op;
> - struct client *client = tmem_client_from_current();
> + struct client *client = current->domain->tmem_client;
> struct tmem_pool *pool = NULL;
> struct oid *oidp;
> int rc = 0;
> @@ -2595,12 +2595,12 @@ long do_tmem_op(tmem_cli_op_t uops)
> if ( !tmem_initialized )
> return -ENODEV;
>
> - if ( !tmem_current_permitted() )
> + if ( xsm_tmem_op(XSM_HOOK) )
> return -EPERM;
>
> total_tmem_ops++;
>
> - if ( client != NULL && tmem_client_is_dying(client) )
> + if ( client != NULL && client->domain->is_dying )
> {
> rc = -ENODEV;
> simple_error:
> @@ -2640,7 +2640,7 @@ long do_tmem_op(tmem_cli_op_t uops)
> {
> write_lock(&tmem_rwlock);
> write_lock_set = 1;
> - if ( (client = client_create(tmem_get_cli_id_from_current())) == NULL )
> + if ( (client = client_create(current->domain->domain_id)) == NULL )
> {
> tmem_client_err("tmem: can't create tmem structure for %s\n",
> tmem_client_str);
> @@ -2732,7 +2732,7 @@ void tmem_destroy(void *v)
> if ( client == NULL )
> return;
>
> - if ( !tmem_client_is_dying(client) )
> + if ( !client->domain->is_dying )
> {
> printk("tmem: tmem_destroy can only destroy dying client\n");
> return;
> diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
> index cbdf377..53ad32f 100644
> --- a/xen/include/xen/sched.h
> +++ b/xen/include/xen/sched.h
> @@ -400,7 +400,7 @@ struct domain
> spinlock_t hypercall_deadlock_mutex;
>
> /* transcendent memory, auto-allocated on first tmem op by each domain */
> - void *tmem;
> + struct client *tmem_client;
>
> struct lock_profile_qhead profile_head;
>
> diff --git a/xen/include/xen/tmem_xen.h b/xen/include/xen/tmem_xen.h
> index 9cfa73f..11f4c2d 100644
> --- a/xen/include/xen/tmem_xen.h
> +++ b/xen/include/xen/tmem_xen.h
> @@ -171,45 +171,17 @@ static inline unsigned long tmem_free_mb(void)
>
> /* "Client" (==domain) abstraction */
>
> -struct client;
> static inline struct client *tmem_client_from_cli_id(domid_t cli_id)
> {
> struct client *c;
> struct domain *d = rcu_lock_domain_by_id(cli_id);
> if (d == NULL)
> return NULL;
> - c = (struct client *)(d->tmem);
> + c = d->tmem_client;
> rcu_unlock_domain(d);
> return c;
> }
>
> -static inline struct client *tmem_client_from_current(void)
> -{
> - return (struct client *)(current->domain->tmem);
> -}
> -
> -#define tmem_client_is_dying(_client) (!!_client->domain->is_dying)
> -
> -static inline domid_t tmem_get_cli_id_from_current(void)
> -{
> - return current->domain->domain_id;
> -}
> -
> -static inline struct domain *tmem_get_cli_ptr_from_current(void)
> -{
> - return current->domain;
> -}
> -
> -static inline bool_t tmem_current_permitted(void)
> -{
> - return !xsm_tmem_op(XSM_HOOK);
> -}
> -
> -static inline bool_t tmem_current_is_privileged(void)
> -{
> - return !xsm_tmem_control(XSM_PRIV);
> -}
> -
> static inline uint8_t tmem_get_first_byte(struct page_info *pfp)
> {
> const uint8_t *p = __map_domain_page(pfp);
> --
> 1.7.10.4
>
next prev parent reply other threads:[~2013-12-13 16:44 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-12 11:05 [PATCH v4 00/15] xen: continue to cleanup tmem Bob Liu
2013-12-12 11:05 ` [PATCH v4 01/15] tmem: cleanup: drop unused sub command Bob Liu
2013-12-12 11:05 ` [PATCH v4 02/15] tmem: cleanup: drop some debug code Bob Liu
2013-12-12 11:05 ` [PATCH v4 03/15] tmem: cleanup: drop useless function 'tmem_copy_page' Bob Liu
2013-12-12 11:05 ` [PATCH v4 04/15] tmem: cleanup: drop useless parameters from put/get page Bob Liu
2013-12-12 11:05 ` [PATCH v4 05/15] tmem: cleanup: reorg function do_tmem_put() Bob Liu
2013-12-12 11:05 ` [PATCH v4 06/15] tmem: drop unneeded is_ephemeral() and is_private() Bob Liu
2013-12-12 11:05 ` [PATCH v4 07/15] tmem: cleanup: rm useless EXPORT/FORWARD define Bob Liu
2013-12-12 11:05 ` [PATCH v4 08/15] tmem: cleanup: drop tmem_lock_all Bob Liu
2013-12-12 11:05 ` [PATCH v4 09/15] tmem: cleanup: refactor the alloc/free path Bob Liu
2013-12-12 11:05 ` [PATCH v4 10/15] tmem: cleanup: __tmem_alloc_page: drop unneed parameters Bob Liu
2013-12-12 11:05 ` [PATCH v4 11/15] tmem: cleanup: drop useless functions from head file Bob Liu
2013-12-13 16:44 ` Konrad Rzeszutek Wilk [this message]
2014-01-07 10:44 ` Bob Liu
2014-01-07 14:27 ` Konrad Rzeszutek Wilk
2014-01-07 14:32 ` Ian Campbell
2014-01-07 14:44 ` Jan Beulich
2014-01-07 14:52 ` Ian Campbell
2014-01-07 15:51 ` Keir Fraser
2013-12-12 11:05 ` [PATCH v4 12/15] tmem: refator function tmem_ensure_avail_pages() Bob Liu
2013-12-12 11:05 ` [PATCH v4 13/15] tmem: cleanup: rename tmem_relinquish_npages() Bob Liu
2013-12-12 11:05 ` [PATCH v4 14/15] tmem: cleanup: rm unused tmem_freeze_all() Bob Liu
2013-12-12 11:05 ` [PATCH v4 15/15] tmem: check the return value of copy to guest Bob Liu
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=20131213164405.GA11305@phenom.dumpdata.com \
--to=konrad.wilk@oracle.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=james.harper@bendigoit.com.au \
--cc=keir@xen.org \
--cc=lliubbo@gmail.com \
--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.