From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v3 08/24] xen/arm: Allow virq != irq Date: Fri, 27 Feb 2015 15:55:03 +0000 Message-ID: <54F09357.6060301@linaro.org> References: <1421159133-31526-1-git-send-email-julien.grall@linaro.org> <1421159133-31526-9-git-send-email-julien.grall@linaro.org> <1424447564.30924.322.camel@citrix.com> <54E76A2C.7030403@linaro.org> <54F08031.1070807@linaro.org> <1425048254.14641.218.camel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YRNGG-00016L-PH for xen-devel@lists.xenproject.org; Fri, 27 Feb 2015 15:55:32 +0000 Received: by wevm14 with SMTP id m14so21216746wev.8 for ; Fri, 27 Feb 2015 07:55:31 -0800 (PST) In-Reply-To: <1425048254.14641.218.camel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: xen-devel@lists.xenproject.org, tim@xen.org, stefano.stabellini@citrix.com List-Id: xen-devel@lists.xenproject.org On 27/02/15 14:44, Ian Campbell wrote: > On Fri, 2015-02-27 at 14:33 +0000, Julien Grall wrote: >> Hi Ian, >> >> On 20/02/15 17:09, Julien Grall wrote: >>> On 20/02/15 15:52, Ian Campbell wrote: >>>>> >>>>> action = xmalloc(struct irqaction); >>>>> - if (!action) >>>>> + if ( !action ) >>>>> + return -ENOMEM; >>>>> + >>>>> + info = xmalloc(struct irq_guest); >>>> >>>> FWIW you might (subject to sizing/alignment needs) be able to do >>>> action = _xmalloc(sizeof(struct irqaction) + sizeof(struct irq_guest); >>>> info = (sturct irq_guest *)(action + 1); >>>> >>>> which would save some memory overhead for free pointers etc and allow >>>> you to avoid manually managing the info. >>>> >>>> You probably won't like that though, so feel free to ignore. >>> >>> Actually it's a good idea :). I haven't though about it. >> >> I though about it. The pointer to irq_guest may not be correctly aligned >> with this solution, right? > > It depends on sizeof(struct irqaction) (which is what I meant by > "subject to..."). t'd probably need a ROUNDUP(sizeof(foo), > pointer-alignement) in there somewhere. Oh right, I missed the parentheses part. The pointer alignment is not the same on ARM32 and ARM64, I need to think more about it. Regards, -- Julien Grall