Re: [PATCH v1 1/4] s390x: saving regs for interrupts

David Hildenbrand
2019-11-14T15:25:26Z

> Am 14.11.2019 um 16:21 schrieb Pierre Morel <pmorel@linux.ibm.com>:
>
> ﻿
>> On 2019-11-14 13:11, David Hildenbrand wrote:
>>> On 14.11.19 12:57, Pierre Morel wrote:
>>>
>>> On 2019-11-14 11:28, David Hildenbrand wrote:
>>>>
>>>>> Am 14.11.2019 um 11:11 schrieb Pierre Morel <pmorel@linux.ibm.com>:
>>>>>
>>>>> ﻿
>>>>>> On 2019-11-13 17:12, Janosch Frank wrote:
>>>>>>> On 11/13/19 1:23 PM, Pierre Morel wrote:
>>>>>>> If we use multiple source of interrupts, for exemple, using SCLP console
>>>>>>> to print information while using I/O interrupts or during exceptions, we
>>>>>>> need to have a re-entrant register saving interruption handling.
>>>>>>>
>>>>>>> Instead of saving at a static place, let's save the base registers on
>>>>>>> the stack.
>>>>>>>
>>>>>>> Note that we keep the static register saving that we need for the RESET
>>>>>>> tests.
>>>>>>>
>>>>>>> We also care to give the handlers a pointer to the save registers in
>>>>>>> case the handler needs it (fixup_pgm_int needs the old psw address).
>>>>>> So you're still ignoring the FPRs...
>>>>>> I disassembled a test and looked at all stds and it looks like printf
>>>>>> and related functions use them. Wouldn't we overwrite test FPRs if
>>>>>> printing in a handler?
>>>>> If printf uses the FPRs in my opinion we should modify the compilation options for the library.
>>>>>
>>>>> What is the reason for printf and related functions to use floating point?
>>>>>
>>>> Register spilling. This can and will be done.
>>>
>>>
>>> Hum, can you please clarify?
>>>
>>> AFAIK register spilling is for a compiler, to use memory if it has not
>>> enough registers.
>>
>> Not strictly memory. If the compiler needs more GPRS, it can save/restore GPRS to FPRS.
>>
>> Any function the compiler generates is free to use the FPRS..
>>
>>>
>>> So your answer is for the my first sentence, meaning yes register
>>> spilling will be done
>>> or
>>> do you mean register spilling is the reason why the compiler use FPRs
>>> and it must be done so?
>>
>> Confused by both options :D The compiler might generate code that uses the FPRS although no floating point instructions are in use. That's why we have to enable the AFP control and properly take care of FPRS being used.
>>
>>
> The compiler has the -msoft-float switch to avoid using the floating point instructions and registers, so it is our decision.

No, not registers AFAIK.

>
> Saving the FP registers on exceptions is not very efficient, we loose time on each interrupt, not sure that we win it back by using FPregs to as Regs backup.

Who on earth cares about performance here?

>
> Usually a system at low level uses some enter_fpu, leave_fpu routine to enter critical sections using FPU instead of losing time on each interruptions.
>
> We can think about this, in between I do as you recomand and save the FPregs too.
>
> Best regards,
>
> Pierre
>
>
> --
> Pierre Morel
> IBM Lab Boeblingen
>