[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] xen/arm: add warning if memory modules overlap


  • To: Julien Grall <julien.grall@xxxxxxx>
  • From: Brian Woods <brian.woods@xxxxxxxxxx>
  • Date: Fri, 11 Oct 2019 11:06:13 -0700
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=epam.com smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ro/IXZNeJk7uEKsnIrx4BOeN59o+Yyh/93GJ9j/XiMI=; b=Q9Q25xYVbudkvM0rCyV5GOFdrtmbNVs4tfaM/FxrnNUkKapqD+qaFZ3xJUZHL3AGDM/4evN1HB3jJfO1WFhVBg/+6pE3d2w1nC/NcvtTWWYpaxHpguSGM8GJ28TG4llUBIJ1KBQvxzEAtVM0LH1iZyBOQbi/GRaAUk7/zjY2oSu37T6F5SG8i/orgi7BWYNIN4l6Y7wwHmMqDKs0fDrdq26iaRGKPqIp9yWhzc4OVXb1l0+nBvnNUoNBhgEhXZ97TyZsdCDulIbL+5USGAOP/idaFaKMp47Y5q3Zu50FRHigPwoi/oFaVxYPs5iJhNzKNyl03OhyCsvI0M7EkFPVmQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a92NlEkMOBN8UC4ui1Q4HavkmG3wkXCDpaftYINogt4BPD4v7DHtT7aOZUsANToDoJqmuKjrILBiAjIm6J/gbbQhpNTJKU21z3eLzfxD6FOwctk8w5izX6ETM6LQvNpYr7DW237Gl6L90LeQ1jDv4ulXjthCJQGYaSa2c7gEXE4i27Cqm/dePziW1dLBRuz1nCkuB2bF3WY4JU//8nqsFfu40pWayL4ZcoE5LDeTWtC052MM78QW7IueaqsVMmzFiN4jcZgREzvOt6ubuYiQSTekU3Mb7IoMYDiR6e17xbUgIOLD+ex9e42UaJQE4Be/Ciocycz8M7nxgqgcs9wMlw==
  • Authentication-results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; epam.com; dkim=none (message not signed) header.d=none;epam.com; dmarc=bestguesspass action=none header.from=xilinx.com;
  • Cc: Brian Woods <brian.woods@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 11 Oct 2019 18:06:41 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Fri, Oct 11, 2019 at 05:58:35PM +0100, Julien Grall wrote:
> Hi,
> 
> Please at least remove the signature in the e-mail you reply to. The best
> would be to trim the e-mail and answer right below the specific paragraph.
> 
> >
> >To make sure the module is going to get added, you'd need to do the
> >check after the for loop.  This means there's going to be multiple for
> >loops just spread over the course of adding the boot modules rather than
> >one place.
> 
> I don't think you need to do the check after the loop. The only way to go
> out of the loop in add_boot_module() is when i reached mods->nr_mods.

See below.

> >
> >I had this before but decided against it but after changing it to both
> >starts rather than the stand and end (ends look much uglier), it looks
> >cleaner.
> >
> >     for ( i = 0 ; i < mods->nr_mods-1; i++ )
> >         for ( j = i+1 ; j < mods->nr_mods; j++ )
> >             if ( ((mods->module[i].start >= mods->module[j].start) &&
> >                   (mods->module[i].start <=
> >                    mods->module[j].start + mods->module[j].size)) ||
> >                  ((mods->module[j].start >= mods->module[i].start) &&
> >                   (mods->module[j].start <=
> >                    mods->module[i].start + mods->module[i].size)) )
> >                 printk("WARNING: modules %-12s and %-12s overlap\n",
> >                        boot_module_kind_as_string(mods->module[i].kind),
> >                        boot_module_kind_as_string(mods->module[j].kind));
> >
> >That's also a possibility.
> >
> >I just don't see a way around it, computationally.  You can split where
> >the loops are executed but in the end the same amount of checks/total
> >iterations have to be run.
> >
> >I was talking to someone and he suggested you could just check Xen at
> >early boot and then check other modules later.
> 
> What's wrong with:
> 
> diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
> index 705a917abf..ecd09ec698 100644
> --- a/xen/arch/arm/setup.c
> +++ b/xen/arch/arm/setup.c
> @@ -254,6 +254,10 @@ struct bootmodule __init
> *add_boot_module(bootmodule_kind kind,
>                  mod->domU = false;
>              return mod;
>          }
> +
> +        if ((mod->start >= start) &&
> +            (mod->start < (start + size)))
> +            printk("WARNING: modules...\n");
>      }
> 
>      mod = &mods->module[mods->nr_mods++];
> 
> Cheers,
> 
> -- 
> Julien Grall

For that, you'd need to either check the start and end of the added
module or the start of both.  So something like:

if ( ((mod->start >= start) && (mod->start < (start + size))) ||
     ((start >= mod->start) && (start < (mod->start + mod->size))) )
    printk("WARNING: ...");

If you don't you run the risk of having a module overlap but not at the
start of the added module (unless there's a guaranteed order).  You're
still running all of the checks from what I can tell, just not in nested
for loop so. Plus I'm not sure how many times add_boot_module gets run
and the "mod->kind == kind .." if statement gets run and is true.
If the above is true, wouldn't that cause extra checks for the for loop
iterations before it was true?

Brian

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.