From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
"Jan Beulich" <JBeulich@suse.com>,
"Roger Pau Monné" <roger.pau@citrix.com>, "Wei Liu" <wl@xen.org>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Julien Grall" <julien@xen.org>,
"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>,
"Tamas K Lengyel" <tamas@tklengyel.com>
Subject: [PATCH 2/4] xen/evtchn: Switch to dmalloc
Date: Wed, 23 Dec 2020 16:34:40 +0000 [thread overview]
Message-ID: <20201223163442.8840-3-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <20201223163442.8840-1-andrew.cooper3@citrix.com>
This causes memory allocations to be tied to domain in question.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Wei Liu <wl@xen.org>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien@xen.org>
CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
CC: Tamas K Lengyel <tamas@tklengyel.com>
RFC: Likely more to convert. This is just a minimal attempt.
---
xen/common/event_channel.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index 4a48094356..f0ca0933e3 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -16,6 +16,7 @@
#include "event_channel.h"
+#include <xen/dmalloc.h>
#include <xen/init.h>
#include <xen/lib.h>
#include <xen/errno.h>
@@ -153,7 +154,7 @@ static struct evtchn *alloc_evtchn_bucket(struct domain *d, unsigned int port)
struct evtchn *chn;
unsigned int i;
- chn = xzalloc_array(struct evtchn, EVTCHNS_PER_BUCKET);
+ chn = dzalloc_array(d, struct evtchn, EVTCHNS_PER_BUCKET);
if ( !chn )
return NULL;
@@ -182,7 +183,7 @@ static void free_evtchn_bucket(struct domain *d, struct evtchn *bucket)
for ( i = 0; i < EVTCHNS_PER_BUCKET; i++ )
xsm_free_security_evtchn(bucket + i);
- xfree(bucket);
+ dfree(d, bucket);
}
int evtchn_allocate_port(struct domain *d, evtchn_port_t port)
@@ -204,7 +205,7 @@ int evtchn_allocate_port(struct domain *d, evtchn_port_t port)
if ( !group_from_port(d, port) )
{
- grp = xzalloc_array(struct evtchn *, BUCKETS_PER_GROUP);
+ grp = dzalloc_array(d, struct evtchn *, BUCKETS_PER_GROUP);
if ( !grp )
return -ENOMEM;
group_from_port(d, port) = grp;
@@ -1488,7 +1489,7 @@ int evtchn_init(struct domain *d, unsigned int max_port)
write_atomic(&d->active_evtchns, 0);
#if MAX_VIRT_CPUS > BITS_PER_LONG
- d->poll_mask = xzalloc_array(unsigned long, BITS_TO_LONGS(d->max_vcpus));
+ d->poll_mask = dzalloc_array(d, unsigned long, BITS_TO_LONGS(d->max_vcpus));
if ( !d->poll_mask )
{
free_evtchn_bucket(d, d->evtchn);
@@ -1545,13 +1546,12 @@ void evtchn_destroy_final(struct domain *d)
continue;
for ( j = 0; j < BUCKETS_PER_GROUP; j++ )
free_evtchn_bucket(d, d->evtchn_group[i][j]);
- xfree(d->evtchn_group[i]);
+ dfree(d, d->evtchn_group[i]);
}
free_evtchn_bucket(d, d->evtchn);
#if MAX_VIRT_CPUS > BITS_PER_LONG
- xfree(d->poll_mask);
- d->poll_mask = NULL;
+ DFREE(d, d->poll_mask);
#endif
}
--
2.11.0
next prev parent reply other threads:[~2020-12-23 16:35 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-23 16:34 [PATCH 0/4] xen: domain-tracked allocations, and fault injection Andrew Cooper
2020-12-23 16:34 ` [PATCH 1/4] xen/dmalloc: Introduce dmalloc() APIs Andrew Cooper
2021-01-05 15:56 ` Jan Beulich
2021-01-13 23:16 ` Andrew Cooper
2021-01-14 10:14 ` Jan Beulich
2021-01-14 15:30 ` Andrew Cooper
2021-01-05 16:01 ` Jan Beulich
2022-12-11 17:24 ` Julien Grall
2020-12-23 16:34 ` Andrew Cooper [this message]
2021-01-05 16:09 ` [PATCH 2/4] xen/evtchn: Switch to dmalloc Jan Beulich
2020-12-23 16:34 ` [PATCH 3/4] xen/domctl: Introduce fault_ttl Andrew Cooper
2021-01-05 16:39 ` Jan Beulich
2021-01-13 23:58 ` Andrew Cooper
2020-12-23 16:34 ` [PATCH 4/4] tools/misc: Test for fault injection Andrew Cooper
2020-12-23 16:41 ` Jan Beulich
2021-01-08 1:49 ` [PATCH 0/4] xen: domain-tracked allocations, and " Stefano Stabellini
2022-12-11 17:21 ` Julien Grall
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=20201223163442.8840-3-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=julien@xen.org \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--cc=tamas@tklengyel.com \
--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.