diff mbox

[Xen-devel,v3,10/10] xen: arm: Only lookup kernel bootmodule once while building dom0 dtb.

Message ID 1405688900-11769-10-git-send-email-ian.campbell@citrix.com
State New
Headers show

Commit Message

Ian Campbell July 18, 2014, 1:08 p.m. UTC
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
v3: New patch
---
 xen/arch/arm/domain_build.c |    4 +++-
 xen/arch/arm/kernel.h       |    1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

Comments

Julien Grall July 18, 2014, 9:06 p.m. UTC | #1
Hi Ian,

On 18/07/14 14:08, Ian Campbell wrote:
> diff --git a/xen/arch/arm/kernel.h b/xen/arch/arm/kernel.h
> index 7c7f624..2745bb5 100644
> --- a/xen/arch/arm/kernel.h
> +++ b/xen/arch/arm/kernel.h
> @@ -23,6 +23,7 @@ struct kernel_info {
>       paddr_t entry;
>
>       /* boot blob load addresses */
> +    struct bootmodule *bootmodule;

If you don't read the assignment in the code you don't know to which 
module the variable pointed to. I would rename to smth like kernelmodule.

Regards,
Ian Campbell July 21, 2014, 10:20 a.m. UTC | #2
On Fri, 2014-07-18 at 22:06 +0100, Julien Grall wrote:
> Hi Ian,
> 
> On 18/07/14 14:08, Ian Campbell wrote:
> > diff --git a/xen/arch/arm/kernel.h b/xen/arch/arm/kernel.h
> > index 7c7f624..2745bb5 100644
> > --- a/xen/arch/arm/kernel.h
> > +++ b/xen/arch/arm/kernel.h
> > @@ -23,6 +23,7 @@ struct kernel_info {
> >       paddr_t entry;
> >
> >       /* boot blob load addresses */
> > +    struct bootmodule *bootmodule;
> 
> If you don't read the assignment in the code you don't know to which 
> module the variable pointed to. I would rename to smth like kernelmodule.

Good idea.

Ian.
diff mbox

Patch

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 154367e..3db2e94 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -405,7 +405,7 @@  static int write_properties(struct domain *d, struct kernel_info *kinfo,
     int res = 0;
     int had_dom0_bootargs = 0;
 
-    struct bootmodule *mod = boot_module_find_by_kind(BOOTMOD_KERNEL);
+    struct bootmodule *mod = kinfo->bootmodule;
 
     if ( mod && mod->cmdline[0] )
         bootargs = &mod->cmdline[0];
@@ -1307,6 +1307,8 @@  int construct_dom0(struct domain *d)
     d->max_pages = ~0U;
 
     kinfo.unassigned_mem = dom0_mem;
+    kinfo.bootmodule = boot_module_find_by_kind(BOOTMOD_KERNEL);
+    BUG_ON(!kinfo.bootmodule);
 
     rc = kernel_probe(&kinfo);
     if ( rc < 0 )
diff --git a/xen/arch/arm/kernel.h b/xen/arch/arm/kernel.h
index 7c7f624..2745bb5 100644
--- a/xen/arch/arm/kernel.h
+++ b/xen/arch/arm/kernel.h
@@ -23,6 +23,7 @@  struct kernel_info {
     paddr_t entry;
 
     /* boot blob load addresses */
+    struct bootmodule *bootmodule;
     paddr_t dtb_paddr;
     paddr_t initrd_paddr;