[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v7 02/15] s390x: protvirt: Support unpack facility
From: |
David Hildenbrand |
Subject: |
Re: [PATCH v7 02/15] s390x: protvirt: Support unpack facility |
Date: |
Mon, 9 Mar 2020 15:42:38 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 |
On 09.03.20 15:40, Christian Borntraeger wrote:
>
>
> On 09.03.20 14:37, David Hildenbrand wrote:
>
>>>
>>> +#if !defined(CONFIG_USER_ONLY)
>>> +static bool machine_is_pv(MachineState *ms)
>>> +{
>>> + Object *obj;
>>> +
>>> + /* we have to bail out for the "none" machine */
>>> + obj = object_dynamic_cast(OBJECT(ms), TYPE_S390_CCW_MACHINE);
>>> + if (!obj) {
>>> + return false;
>>> + }
>>> + return S390_CCW_MACHINE(obj)->pv;
>>
>> Maybe you want to cache the machine, so you can avoid the
>> lookup+conversion on every new CPU.
>>
>
> something like the following?
>
>
> diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
> index c513f8efe0..cd12c29b9a 100644
> --- a/target/s390x/cpu.c
> +++ b/target/s390x/cpu.c
> @@ -185,13 +185,18 @@ static void s390_cpu_disas_set_info(CPUState *cpu,
> disassemble_info *info)
> static bool machine_is_pv(MachineState *ms)
> {
> Object *obj;
> + static S390CcwMachineState *ccw;
> +
Move this up please (reverse christmas tree ;) )
> + if (ccw)
> + return ccw->pv;
>
> /* we have to bail out for the "none" machine */
> obj = object_dynamic_cast(OBJECT(ms), TYPE_S390_CCW_MACHINE);
> if (!obj) {
> return false;
> }
> - return S390_CCW_MACHINE(obj)->pv;
> + ccw = S390_CCW_MACHINE(obj);
> + return ccw->pv;
> }
> #endif
Yeah, guess this makes sense.
--
Thanks,
David / dhildenb
- [PATCH v7 03/15] s390x: protvirt: Add migration blocker, (continued)
- [PATCH v7 06/15] s390x: Add SIDA memory ops, Janosch Frank, 2020/03/09
- [PATCH v7 10/15] s390x: protvirt: Move diag 308 data over SIDA, Janosch Frank, 2020/03/09
- [PATCH v7 09/15] s390x: protvirt: Set guest IPL PSW, Janosch Frank, 2020/03/09
- [PATCH v7 02/15] s390x: protvirt: Support unpack facility, Janosch Frank, 2020/03/09
- [PATCH v8 1/2] s390x: ipl: Consolidate iplb validity check into one function, Janosch Frank, 2020/03/10
- [PATCH v8 2/2] s390x: protvirt: Support unpack facility, Janosch Frank, 2020/03/10
- Re: [PATCH v8 2/2] s390x: protvirt: Support unpack facility, David Hildenbrand, 2020/03/10
- Re: [PATCH v8 2/2] s390x: protvirt: Support unpack facility, Janosch Frank, 2020/03/10
- Re: [PATCH v8 2/2] s390x: protvirt: Support unpack facility, David Hildenbrand, 2020/03/10
- Re: [PATCH v8 2/2] s390x: protvirt: Support unpack facility, Christian Borntraeger, 2020/03/10
- Re: [PATCH v8 1/2] s390x: ipl: Consolidate iplb validity check into one function, David Hildenbrand, 2020/03/10