Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1601785pxm; Thu, 24 Feb 2022 06:16:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJxxqOFjsK78l4zDrUGXFZIzO1sRa/xgu04UUbQWe80aCgdPIBswQW5ong5/+z1BiacV5nhg X-Received: by 2002:a17:906:1e94:b0:6cc:4382:f12e with SMTP id e20-20020a1709061e9400b006cc4382f12emr2425207ejj.482.1645712182840; Thu, 24 Feb 2022 06:16:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645712182; cv=none; d=google.com; s=arc-20160816; b=e6LCAWFZoSf3D8LgR/+5C3Fo1QGwGoGHr7h+wd1egPqw5R7tdpf8QCd6ZAOLkh7XIP XyoKkQlxxRiyOW9HJlyQmy3WRsTfjPbZEHnFs3k+q5M4c/jUI8/+MiEk0y/w/K6i58dJ HzRKuFUo19TRnWYQuDRnSBDm8V2ifrl4NK9rP1bTrHLyX/5Cv17iYUS/t7ezo9rhnhyy zvN4VAE/ceG/IzklJnhCLvnKXWZsDYDyPew07Me3SaAaHzpP55BLSwDKR5dAYm5g4SZJ MmVQe7IMxgWD1zEt51LsHn2nQrO/KBOY+iSiGCZ8rQsebyU7jVlRBUHPB95TLhLcL5K7 gI4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id :mime-version:in-reply-to:references:cc:to:subject:from:date :dkim-signature; bh=WjQC5Y7ro/c9MdCjVexTb0YJtz1qK4y19XmmyHlyFew=; b=CdW541lzOqotzvwBsy8O1NXFI40G8+8Xh6eMxJPU0HTMQ0sUhKBPeY5GPEjK9jAZZL Qf15Bu55lK2DEzGCGkiOWuMF181gOReJLnTKjaxlfcX1b9PdNHcgFQcpRU3MKxUd7Qka bqm1iWu6Y3b66Stn6DFyhBDoWlvCnmf2UxlaGT0gU2N/BIJPYPRd/TXkhI3dIqbVyAHk kyFMIF6rj8M9C6cY839TyVkY18WNRxdqUSCaQ0ebrhg68M35fk/x+s8x3fKAs/FhcAd1 LVQmRFdQEBHlpguGYyXufOL+lWklnBi3iC88H/qKjuMI/TdEyjmHx0ptGOWK/HNsF5El cDbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Jirg0vzi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di2si1674412ejc.796.2022.02.24.06.15.58; Thu, 24 Feb 2022 06:16:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Jirg0vzi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232052AbiBXLOI (ORCPT + 99 others); Thu, 24 Feb 2022 06:14:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233759AbiBXLOC (ORCPT ); Thu, 24 Feb 2022 06:14:02 -0500 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D997293A23; Thu, 24 Feb 2022 03:13:32 -0800 (PST) Received: by mail-pj1-x1029.google.com with SMTP id h17-20020a17090acf1100b001bc68ecce4aso5391553pju.4; Thu, 24 Feb 2022 03:13:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:subject:to:cc:references:in-reply-to:mime-version :message-id:content-transfer-encoding; bh=WjQC5Y7ro/c9MdCjVexTb0YJtz1qK4y19XmmyHlyFew=; b=Jirg0vziGW8V3SRKvS+PjhON7lmoM4owOMTYOfacsP7PA1kucpsNi1ShKnC1Xkovyw o6U9yMSJlGTp/9bdcko9RMowA7lWuUecDmFzi+XEIU8N0VGjsiQpJZu1tXNBvuyMs/p2 rbCJzpbTs4etXqH/zrJ3B4vY3NwUmDan5gFm5+guije2IkK/PL83p0+na++9vFREa4W4 ArHXY4YXbYTIFTn95zCxQOQz6HcTe5XGs4vkROZUfpVuMcPdX7MbSwcnlAglD3ApP9Jx lWwz3Oy0jJU+P8hF7OM/qdSde4sPYz/DR+kmgZ6Fea+azQZS46sldPZe+9sBPmJhsJ8u +1sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=WjQC5Y7ro/c9MdCjVexTb0YJtz1qK4y19XmmyHlyFew=; b=OXfcT3gaQXUYsOKyjXe8G0KpcQNzY6fAwSVcEwqEXDi7iZEfDmpAGj7J8mDaa6XSeT XigByXl8jIvnJWhReya6PZud4k/wl59JY0g/mEMw7CGxNWcR1V9P7D1Pifi8r5qihEbY 55bxZRJqLfuQzMOMrbcQOP8Xc2tBNtd++JUcldSMnDYAp7c2k5UVkO+4sf2H08AzCvES kVgEmRILFF5DdAxGb+2HiwZQsRoKeE1yHIoAv8saY5mkyjZyqmibJUZYibQrepEN0Ugs 54g0fJ+tA5siI6pWMUoiAMxIpEjBLYsaWLKUoF0+2nyVts3lX+oYp72CvQ/TJdqAPBiP xxdw== X-Gm-Message-State: AOAM533YDA5ahYS4HzQtB6oXH67JHwU3ADguuR3fJT4sfNoRDXFMK1p7 nTb9mjHN2BhfeeVR+qhJfnM= X-Received: by 2002:a17:90b:400c:b0:1bc:7190:5696 with SMTP id ie12-20020a17090b400c00b001bc71905696mr2284455pjb.109.1645701211364; Thu, 24 Feb 2022 03:13:31 -0800 (PST) Received: from localhost (115-64-212-59.static.tpgi.com.au. [115.64.212.59]) by smtp.gmail.com with ESMTPSA id q1sm2911458pfs.112.2022.02.24.03.13.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Feb 2022 03:13:30 -0800 (PST) Date: Thu, 24 Feb 2022 21:13:25 +1000 From: Nicholas Piggin Subject: Re: [PATCH 2/3] powerpc: fix build errors To: Arnd Bergmann Cc: Anders Roxell , Linux Kernel Mailing List , linuxppc-dev , Michael Ellerman , "# 3.4.x" References: <20220223135820.2252470-1-anders.roxell@linaro.org> <20220223135820.2252470-2-anders.roxell@linaro.org> <1645670923.t0z533n7uu.astroid@bobo.none> <1645678884.dsm10mudmp.astroid@bobo.none> <1645694174.z03tip9set.astroid@bobo.none> In-Reply-To: MIME-Version: 1.0 Message-Id: <1645700767.qxyu8a9wl9.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Excerpts from Arnd Bergmann's message of February 24, 2022 8:20 pm: > On Thu, Feb 24, 2022 at 11:11 AM Nicholas Piggin wrot= e: >> Excerpts from Arnd Bergmann's message of February 24, 2022 6:55 pm: >> > On Thu, Feb 24, 2022 at 6:05 AM Nicholas Piggin wr= ote: >> > We had the same thing on Arm a few years ago when binutils >> > started enforcing this more strictly, and it does catch actual >> > bugs. I think annotating individual inline asm statements is >> > the best choice here, as that documents what the intention is. >> >> A few cases where there are differences in privileged instructions >> (that won't be compiler generated), that will be done anyway. >> >> For new instructions added to the ISA though? I think it's ugly and >> unecesaary. There is no ambiguity about the intention when you see >> a lharx instruction is there? >> >> It would delinate instructions that can't be used on all processors >> but I don't see much advantage there, it's not an exhaustive check >> because we have other restrictions on instructions in the kernel >> environment. And why would inline asm be special but not the rest >> of the asm? Would you propose to put these .machine directives >> everywhere in thousands of lines of asm code in the kernel? I >> don't know that it's an improvement. And inline asm is a small >> fraction of instructions. >=20 > Most of the code is fine, as we tend to only build .S files that > are for the given target CPU, That's not true on powerpc at least. grep FTR_SECTION. Not all of them are different ISA, but it's more than just the CPU_FTR_ARCH ones which only started about POWER7. > the explicit .machine directives are > only needed when you have a file that mixes instructions for > incompatible machines, using a runtime detection. Right. There are .S files are in that category. And a lot of it for inline and .S we probably skirt entirely due to using raw=20 instruction encoding because of old toolchains (which gets no error=20 checking at all) which we really should tidy up and trim. >=20 >> Right that should be caught if you just pass -m architecture >> to the assembler that does not include the mtpmr. 32-bit is a lot more >> complicated than 64s like this though, so it's pssible in some cases >> you will want more checking and -m + some .machine directives >> will work better. >> >> Once you add the .machine directive to your inline asm though, you lose >> *all* such static checking for the instruction. So it's really not a >> panacea and has its own downsides. >=20 > Again, there should be a minimum number of those .machine directives > in inline asm as well, which tends to work out fine as long as the > entire kernel is built with the correct -march=3D option for the minimum > supported CPU, and stays away from inline asm that requires a higher > CPU level. There's really no advantage to them, and they're ugly and annoying and if we applied the concept consistently for all asm they would grow=20 to a very large number. The idea they'll give you good static checking just doesn't really pan out. Thanks, Nick