Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1911944imu; Sun, 16 Dec 2018 11:47:25 -0800 (PST) X-Google-Smtp-Source: AFSGD/X3SEssOn6zXtPjXi5N1eSQ8LCs1imrilxau80lpzTwKY20jgIrALxAPZZlg1wWuMv6dXYW X-Received: by 2002:a17:902:4324:: with SMTP id i33mr9954765pld.227.1544989645904; Sun, 16 Dec 2018 11:47:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544989645; cv=none; d=google.com; s=arc-20160816; b=h30cu8FgS9MU+RyeQtr72hTMZc3KbyQjltmcw/kJiGUcbgzYbdAEkw5jtfHb29akNb 5hI5PX8V1QgNBG6VMfPYEFcijH2n6TEqUpJA+XbxX+HG/ZTufOM4t1PdC2Fu2MeL3rZ/ mIZz9+YaBkWIHycpANr6ZQbJBlmriiGM4kqFrbmZXjUGWSddxwb4YkeR0BzRXdWTiUlL VcMo0AsoiAUhuuuDDLyl1IIWHUBgslGbhJtPSfNHhlnHAp+UHTrraRcXMExGKIyTr4t3 nV8F5M0K1FLO2BMF77lEApEa5RbnpVRRx/YiarP6ZTE0S513PfoAf2CUb5CuQWjOgGtA gMdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=MYI2WewMcGBsy/HLhYEkqsCCntgmZWzGkc09+r3ybdw=; b=vZTme7lodQrN7ZfEDMqEsXS/X1FTOL/AAN/3otVmuak+Guk+9CydytgRAtfB0FjgsI cP0aJ2MswR3THNF5G0cWwidO7XkK6Dr2LfNoyx6yF3+0nLG8K1vDup3OykTVpwyyBDCH BeH+FwQJ1qccRYiGDIZYODUUaA+Dr2lRLJNif3fb5W2ubgpTmAAgW5ZqlGGNjWdapf+A 9PWYh/C3TU4MbMtDk/fPVx/krF/+B1ZsgBCwoJVpxqBw67c2BiAdqrYvbGeIwKIbuhT+ PvXVV+hPEqRndqNW5tYTth9/BkfDfkFZU1Dho1NarsuWYuhe9vzrrdSip4BHmFymVCg2 ujJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d125si8814848pgc.418.2018.12.16.11.47.09; Sun, 16 Dec 2018 11:47:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730878AbeLPTpD (ORCPT + 99 others); Sun, 16 Dec 2018 14:45:03 -0500 Received: from eddie.linux-mips.org ([148.251.95.138]:56600 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730673AbeLPTpD (ORCPT ); Sun, 16 Dec 2018 14:45:03 -0500 Received: (from localhost user: 'macro', uid#1010) by eddie.linux-mips.org with ESMTP id S23992280AbeLPTpA1mgAN (ORCPT ); Sun, 16 Dec 2018 20:45:00 +0100 Date: Sun, 16 Dec 2018 19:45:00 +0000 (GMT) From: "Maciej W. Rozycki" To: Andy Lutomirski cc: Rich Felker , Linux MIPS Mailing List , LKML , Paul Burton , David Daney , Ralf Baechle , Paul Burton , James Hogan Subject: Re: Fixing MIPS delay slot emulation weakness? In-Reply-To: Message-ID: References: <20181215225009.GB23599@brightrain.aerifal.cx> <20181216023259.GE23599@brightrain.aerifal.cx> <20181216181336.GG23599@brightrain.aerifal.cx> User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 16 Dec 2018, Andy Lutomirski wrote: > > I think it suffices to emulate what compilers generate in delay slots, > > which should be fairly minimal and stable. At the very least we could > > enumerate everything GCC and LLVM already emit there, and get them to > > upstream a policy of not adding new insns as fpu-delay-slot-allowed. > > If someone is writing asm by hand to do ridiculous things in the delay > > slot with random ISA extensions, they shouldn't expect it to work. > > > > I feel like I have to ask: the real thing preventing emulation is that > new nonstandard instructions might get used in FPU delay slots on > non-FPU-supporting hardware? This seems utterly nuts. If you're > using custom ISA extensions, why on Earth are you also using emulated > floating point instructions? You're targetting a specific known CPU > if you do this, so you should use only instructions that actually work > on that CPU. The FPU is a part of the MIPS/Linux psABI and as far as CPU hardware is concerned it is typically an RTL option for the customer to control when synthesising hardware, just like say the sizes of the caches. IOW you'll have some hardware with FPU and some without that is otherwise identical, and maintaining two sets of binaries for what is a part of the psABI anyway is often seen as not technically or commercially justified. E.g. the (somewhat dated now) 24KEf and 24KEc are complementing standard MIPS32r2+DSP processor cores with and without the FPU respectively. Of course you can stick to the soft-float ABI instead, but then you'll be wasting the FPU resource on FPU cores, so using the hard-float ABI and having instructions emulated on non-FPU cores is usually considered a good compromise. Of course the FPU emulator should have been left to the userland rather than put in the kernel, but that mistake was made many years ago and we need to maintain compatibility. Also someone would actually have to implement that userland emulator. FAOD both GCC and GAS will happily schedule delay slots themselves as long as the candidate instruction is recognised as valid in a delay slot, so there's no need for anyone to do anything manually for the less common instructions to end up in a delay slot. They just need to appear right before a branch or a jump for that to happen. I can't speak for LLVM. Maciej