From patchwork Fri Apr 10 10:40:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 6129 Received: (qmail 99570 invoked by alias); 10 Apr 2015 10:41:21 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 99557 invoked by uid 89); 10 Apr 2015 10:41:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: plane.gmane.org To: libc-alpha@sourceware.org From: Stefan Liebler Subject: Re: Update Linux kernel to current glibc soft-fp Date: Fri, 10 Apr 2015 12:40:57 +0200 Lines: 103 Message-ID: References: Mime-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 In-Reply-To: On 04/02/2015 07:44 PM, Joseph Myers wrote: > On Thu, 26 Mar 2015, Stefan Liebler wrote: > >> According to "error: lvalue required as left operand of assignment": >> Why did you write back r in include/math-emu/op-common.h: >> #define _FP_FROM_INT(fs, wc, X, r, rsize, rtype): >> if ((X##_s = ((r) < 0))) >> (r) = -(rtype) (r); >> _FP_FROM_INT_ur = (rtype) (r); > > Because the _FP_FROM_INT interface requires an argument of the correct > signedness, but needs to work internally on an unsigned value, so starts > by negating a signed argument. > >> @@ -435,11 +436,12 @@ void s390_adjust_jiffies(void) >> * by the cpu capability number. Yes, that means a floating >> * point division .. math-emu here we come :-) >> */ >> - FP_UNPACK_SP(SA, &fmil); >> - if ((info->capability >> 23) == 0) >> - FP_FROM_INT_S(SB, (long) info->capability, 64, long); >> - else >> - FP_UNPACK_SP(SB, &info->capability); >> + FP_UNPACK_SEMIRAW_SP(SA, &fmil); >> + if ((info->capability >> 23) == 0) { >> + unsigned long r = info->capability; >> + FP_FROM_INT_S(SB, r, 64, unsigned long); >> + } else >> + FP_UNPACK_SEMIRAW_SP(SB, &info->capability); >> FP_DIV_S(SR, SA, SB); >> FP_TO_INT_S(capability, SR, 32, 0); > > Division uses cooked inputs and outputs. FP_TO_INT uses raw inputs. > FP_FROM_INT uses raw outputs. > > So for unpacking SA you should continue to use FP_UNPACK_SP, as the result > goes straight into division. For unpacking SB, it seems appropriate to > use FP_UNPACK_RAW_SP. Then, after either unpacking or FP_FROM_INT_S, you > have a raw value in SB, and can use _FP_UNPACK_CANONICAL to produce a > cooked value from it that can be used as an input to the division. > > As for the integer argument to FP_FROM_INT_S, the existing code treats it > as signed long, so the same semantics would be preserved by making the > temporary variable of that type (however, you still need to pass "unsigned > long" as the last argument to FP_FROM_INT_S, as it expects the type name > passed to be the name of an unsigned type). > Thanks for this information. I applied your patch from 23.03.2015 to linux-next without the removed file arch/s390/math-emu/math.c, adjusted s390_adjust_jiffies() method in arch/s390/kernel/sysinfo.c (see attached patch) and build and booted the new kernel. The value "bogomips per cpu" in /proc/cpuinfo is equal to this value without these patches. Bye Stefan diff --git a/arch/s390/kernel/sysinfo.c b/arch/s390/kernel/sysinfo.c index 99babea..f963474 100644 --- a/arch/s390/kernel/sysinfo.c +++ b/arch/s390/kernel/sysinfo.c @@ -418,6 +418,7 @@ void s390_adjust_jiffies(void) FP_DECL_S(SA); FP_DECL_S(SB); FP_DECL_S(SR); FP_DECL_EX; unsigned int capability; + int mode = 0; info = (void *) get_zeroed_page(GFP_KERNEL); if (!info) @@ -436,11 +437,15 @@ void s390_adjust_jiffies(void) * point division .. math-emu here we come :-) */ FP_UNPACK_SP(SA, &fmil); - if ((info->capability >> 23) == 0) - FP_FROM_INT_S(SB, (long) info->capability, 64, long); + if ((info->capability >> 23) == 0) { + long r = info->capability; + FP_FROM_INT_S(SB, r, 64, unsigned long); + } else - FP_UNPACK_SP(SB, &info->capability); + FP_UNPACK_RAW_SP(SB, &info->capability); + _FP_UNPACK_CANONICAL(S, 1, SB); FP_DIV_S(SR, SA, SB); + _FP_PACK_CANONICAL(S, 1, SR); FP_TO_INT_S(capability, SR, 32, 0); } else /*