WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] Fix non-debug build after c/s 23767:80e9fcdaef36

To: Keir Fraser <keir.xen@xxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] Fix non-debug build after c/s 23767:80e9fcdaef36
From: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
Date: Mon, 22 Aug 2011 15:02:07 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Mon, 22 Aug 2011 07:06:34 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=XOE/NwvxVt2gWcuJk9dwCqxaG9b+O+pcleeddfkWIJs=; b=fy2cfZ4u+2HQorZCS+6z77XYsLb7rXNEVBjjpDTBcEPo0ITEMtWP/oeS1dN+urpqE3 a1VXDb2vcDhrfaKtcaDnEX23LVxCzFj+ZuKQMRYfqy1yfhvUQZHfhRxBL83hznZEmGRj nIXOMVW0v1MI6BzbHykdNQqeTsitCJr0OjDxE=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <CA781999.1F93E%keir.xen@xxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <ac4de6b4c457d27c49c7.1314019381@elijah> <CA781999.1F93E%keir.xen@xxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
That seems to compile just fine, and obviously makes the code a lot
cleaner.  The only thing is that this will still cause functions
inside ASSERTS (spin_is_locked() in this case) to be called; I thought
part of the reason for having ASSERTs in the debug build only was to
reduce the cost of all the checks (the other reason to avoid
unnecessary crashes on production builds)?

 -George

On Mon, Aug 22, 2011 at 2:35 PM, Keir Fraser <keir.xen@xxxxxxxxx> wrote:
> George,
>
> Would something like this work more generically for the non-debug case?
>
> #define ASSERT(p) do { if (p); } while (0)
>
>  -- Keir
>
> On 22/08/2011 14:23, "George Dunlap" <george.dunlap@xxxxxxxxxxxxx> wrote:
>
>> The hd variable in iommu_update_pde_count() and iommu_merge_pages() is
>> only used in the ASSERT, causing gcc to complain about the variable being
>> unused in non-debug builds.
>>
>> Only define the variable for debug builds.
>>
>> Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
>>
>> diff -r 2029263c501c -r ac4de6b4c457 xen/drivers/passthrough/amd/iommu_map.c
>> --- a/xen/drivers/passthrough/amd/iommu_map.c Mon Aug 22 10:12:36 2011 +0100
>> +++ b/xen/drivers/passthrough/amd/iommu_map.c Mon Aug 22 12:54:42 2011 +0100
>> @@ -462,7 +462,9 @@ static int iommu_update_pde_count(struct
>>      unsigned long first_mfn;
>>      u64 *table, *pde, *ntable;
>>      u64 ntable_maddr, mask;
>> +#ifndef NDEBUG
>>      struct hvm_iommu *hd = domain_hvm_iommu(d);
>> +#endif
>>      bool_t ok = 0;
>>
>>      ASSERT( spin_is_locked(&hd->mapping_lock) && pt_mfn );
>> @@ -517,7 +519,9 @@ static int iommu_merge_pages(struct doma
>>      u64 *table, *pde, *ntable;
>>      u64 ntable_mfn;
>>      unsigned long first_mfn;
>> +#ifndef NDEBUG
>>      struct hvm_iommu *hd = domain_hvm_iommu(d);
>> +#endif
>>
>>      ASSERT( spin_is_locked(&hd->mapping_lock) && pt_mfn );
>>
>>
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@xxxxxxxxxxxxxxxxxxx
>> http://lists.xensource.com/xen-devel
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel
>

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel