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

Re: [Xen-devel] [PATCH RFC for-4.13 09/10] xen/arm: asm: Replace use of ALTERNATIVE with alternative_if


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Julien Grall <Julien.Grall@xxxxxxx>
  • Date: Tue, 1 Oct 2019 22:44:04 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; 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=61eAluV5SxgImzPumZ+YbsbxTCdfCoHmK+Cgv7T5rCM=; b=DEHbAlYRADTtskMlShJZfhfvEQBO2hTDgCoAn13KhMIaAZh2L3eY0uatsKT9jttatc79sqn/CcYpRFq7/KzYHQ2L93yAkcsh3Y6zf5J+Iec4HmwRcwbWCajJ+2fIpRFYeAhJ+MTulkw+A/VqXIYig8nh4KK0Jri1M5asHTmBZYODKWZ2lWZH587E/gp77c7MCEwTvecLLwWANipEIvB1/nwF5OeRmlN3KegruFwsvBVaSLBrXKxV3CxFjk5jtqTetLWxcMru+6rjusMf2Wc8V5+o+jFnKACjefb+Bm81KQJjQdXEz+xTKPHXbsyYRwWhFQ3vEs4H1wROxqB2bj4kBA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m5KC2ZY8+t3eVWAERkUVLCN0OdoFqGneckvW6HKvrHepLH0nkSEZWnWzkELm5LnVp4YNtXOjhDfbAPLRV7hRpcPaT7BMyY1nNviqsayDj29STPEVuQabP9dhBJib55Mhtv57IXw6MOBochAfgfXfdBePazYJufJIT56+nJ44pUZH+4rbIxW9JMkxZivQoxcG68bZoVGTjegM+JBsrSl4y1NAMJTohEPmDVTsYhLPvu+JyarqZcbg5+1yqnBMTF0pKuZpS36hVWsEGKaDmfNbnFda9J07ZxpWyOPRBlF/grzzvTwdb3t5jh71SD3uFmM7RIaniMn6IbM60if99TPlzA==
  • Authentication-results: spf=temperror (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.xenproject.org; dmarc=none action=none header.from=arm.com;
  • Authentication-results-original: spf=none (sender IP is ) smtp.mailfrom=Julien.Grall@xxxxxxx;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, nd <nd@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, "andrii.anisov@xxxxxxxxx" <andrii.anisov@xxxxxxxxx>
  • Delivery-date: Tue, 01 Oct 2019 22:44:25 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: True
  • Original-authentication-results: spf=none (sender IP is ) smtp.mailfrom=Julien.Grall@xxxxxxx;
  • Thread-index: AQHVdJmakvRy0HmRrECoJRHrsgituKdGY0kAgAAG9QA=
  • Thread-topic: [PATCH RFC for-4.13 09/10] xen/arm: asm: Replace use of ALTERNATIVE with alternative_if

Hi Stefano,

On 01/10/2019 23:19, Stefano Stabellini wrote:
> On Thu, 26 Sep 2019, Julien Grall wrote:
>> Using alternative_if makes the code a bit more streamlined.
>>
>> Take the opportunity to use the new auto-nop infrastructure to avoid
>> counting the number of nop in the else part for arch/arm/arm64/entry.S
>>
>> Signed-off-by: Julien Grall <julien.grall@xxxxxxx>
>>
>> ---
>>      This is pretty much a matter of taste, but at least for arm64 this
>>      allows us to use the auto-nop infrastructure. So the arm32 is more
>>      to keep inline with arm64.
>> ---
>>   xen/arch/arm/arm32/entry.S | 9 ++++++---
>>   xen/arch/arm/arm64/entry.S | 8 +++++---
>>   2 files changed, 11 insertions(+), 6 deletions(-)
>>
>> diff --git a/xen/arch/arm/arm32/entry.S b/xen/arch/arm/arm32/entry.S
>> index 0b4cd19abd..1428cd3583 100644
>> --- a/xen/arch/arm/arm32/entry.S
>> +++ b/xen/arch/arm/arm32/entry.S
>> @@ -65,9 +65,12 @@ save_guest_regs:
>>            * If the SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT has been set in the 
>> cpu
>>            * feature, the checking of pending SErrors will be skipped.
>>            */
>> -        ALTERNATIVE("nop",
>> -                    "b skip_check",
>> -                    SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT)
>> +        alternative_if SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT
>> +        nop
>> +        alternative_else
>> +        b   skip_check
>> +        alternative_endif
> 
> This could be written as:
> 
> alternative_if_not SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT
> b   skip_check
> alternative_else_nop_endif

Actually my implementation is wrong :/. We want to skip the check if the 
cap is set. So this should be:

alternative_if SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT
b    skip_check
alternative_else_nop_endif

> 
> 
>>           /*
>>            * Start to check pending virtual abort in the gap of Guest -> HYP
>>            * world switch.
>> diff --git a/xen/arch/arm/arm64/entry.S b/xen/arch/arm/arm64/entry.S
>> index 458d12f188..91cf6ee6f4 100644
>> --- a/xen/arch/arm/arm64/entry.S
>> +++ b/xen/arch/arm/arm64/entry.S
>> @@ -170,9 +170,11 @@
>>            * is not set. If a vSError took place, the initial exception will 
>> be
>>            * skipped. Exit ASAP
>>            */
>> -        ALTERNATIVE("bl check_pending_vserror; cbnz x0, 1f",
>> -                    "nop; nop",
>> -                    SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT)
>> +        alternative_if SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT

This would need to be alternative_if_not as want to call the function 
when the cap is not set.

>> +        bl      check_pending_vserror
>> +        cbnz    x0, 1f
>> +        alternative_else_nop_endif
>> +
>>           mov     x0, sp
>>           bl      enter_hypervisor_from_guest_noirq
>>           msr     daifclr, \iflags
>> -- 
>> 2.11.0
>>

Cheeers,

-- 
Julien Grall
_______________________________________________
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®.