Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5138252yba; Wed, 10 Apr 2019 12:11:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqwdfH8OKQh/ABfAIgEMMp9TxOI/Cc7cksO/Fm34q9HFZ2gmnOkLmr2qnD7NVGjNlDVttCm6 X-Received: by 2002:a63:be02:: with SMTP id l2mr40409873pgf.48.1554923507721; Wed, 10 Apr 2019 12:11:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554923507; cv=none; d=google.com; s=arc-20160816; b=lSzJqqAyuex8uGc54FnoK1quY3fnH2SIXRjgOATC8h76t383oytHLKQUcy3WG/+kUB LkhPbMTeIZjFuuUhX94IfDEQGAI4o1Kn9XXgDMOM+AmCGiot99D01ST3KYJdVTI7Cuqu FZ/s2lCNF9q/3Bs2754T2i8PqTZ+J3KDfy7QEzaMrFbq87Cgw2Sw+f2Z0Z13lmO9dEzl SfXR4THXJc63WhAmLXT26MkTuhARzAAJcWTYiuvdM4wuVNcaqk7YuFfznSTvjh4a6Keg GF6cKn+L7TaMhiWspIFuQ4sqr/u92hEFTQp0riY0Hy9Q642lPR1rnqZPc5EVveqXzC44 PD2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=aj8PUHxvs/xbauw0iCG1WEDHVI0PEO9pv0el34MtXJ4=; b=AwyBljyd4QUYiQqR3nA0dysfWemLBJFD/N/e0A0xuH7LFpkdKmE1S0QfQqIpmgQLG9 d7VxpH68Js34Hws2aaivMflhgAyohb4pME1bgVrY74bCo221b9pHXXabSPFcUnE2T+jk ipT3OGiQyqR20d5aNmkiz/dYWXwV99AksBqy8n1a1frEvoKm/krwbcyYuChJ0JdRBnff qKFTLWND8BfIqIj0L9Rjb8s9lYqeodWHUCfX1Rk68npOgjgFWEjsE94qRF254Vejr/mA BL7r8p4VEwBZeAWXxE+wGMs7ZI8K/E71oRfVkmDKR/12MA6EbE9yFfa540tAChZpyi/C FJtg== 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 r190si36025225pfc.14.2019.04.10.12.11.31; Wed, 10 Apr 2019 12:11:47 -0700 (PDT) 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 S1726093AbfDJSzp (ORCPT + 99 others); Wed, 10 Apr 2019 14:55:45 -0400 Received: from mail-qk1-f196.google.com ([209.85.222.196]:41819 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725981AbfDJSzp (ORCPT ); Wed, 10 Apr 2019 14:55:45 -0400 Received: by mail-qk1-f196.google.com with SMTP id o129so1898780qke.8; Wed, 10 Apr 2019 11:55:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=aj8PUHxvs/xbauw0iCG1WEDHVI0PEO9pv0el34MtXJ4=; b=YSn1QgqVs9PpkLcPXy6+cjDcaJ4pXmMZLQGvTbXsv6ERP62oqrLzrG4oPFgwxM69Ed IFI2RMkVaUheg0l2066DkncScrFIsZRMPEYlAwthFi9ruZRaVIr09l67SRLWU2U+NJSn JYiU81+56ohA0iWbRI1lZo/ksS1Hwt/aXPb/r6AoeMqjNK5UOLcve9BhzBu6EJKRGLg/ LB6oMnFunqwqMJLsDC9eA/o/zsFyU46rPVwCo4dBiuVWsUoFt6LbDtZlM1c+YGjW/Mcj PirRcNjAK7eQ0wzZAglN9w58oekkupINWqPzpO428MluclKTBT3N9m8Xyot+J3vqyRnn uVew== X-Gm-Message-State: APjAAAVKNiJZpvu/udilmamWRxCeW8lKvY+plS6ZowxsqNST98ZBhltI Kl+ciBey9W0BUWixmwmZs2nvoZEG61nv06maaco= X-Received: by 2002:a37:f511:: with SMTP id l17mr35610010qkk.296.1554922543926; Wed, 10 Apr 2019 11:55:43 -0700 (PDT) MIME-Version: 1.0 References: <20190408212648.2407234-1-arnd@arndb.de> <20190408212648.2407234-12-arnd@arndb.de> <20190410155513.1609f1a1@mschwideX1> In-Reply-To: <20190410155513.1609f1a1@mschwideX1> From: Arnd Bergmann Date: Wed, 10 Apr 2019 20:55:27 +0200 Message-ID: Subject: Re: [PATCH 12/12] [PROBABLY WRONG] s390: void '0' constraint in inline assembly To: Martin Schwidefsky Cc: Heiko Carstens , clang-built-linux@googlegroups.com, Nick Desaulniers , Nathan Chancellor , linux-s390 , Vasily Gorbik , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 10, 2019 at 3:55 PM Martin Schwidefsky wrote: > > On Mon, 8 Apr 2019 23:26:25 +0200 > Arnd Bergmann wrote: > > > diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h > > index 700c650ffd4f..84c59c99668a 100644 > > --- a/arch/s390/include/asm/processor.h > > +++ b/arch/s390/include/asm/processor.h > > @@ -262,7 +262,7 @@ static __no_kasan_or_inline unsigned short stap(void) > > register unsigned long r4 asm("6") = (unsigned long)(arg5) > > > > #define CALL_FMT_0 > > -#define CALL_FMT_1 CALL_FMT_0, "0" (r2) > > +#define CALL_FMT_1 CALL_FMT_0, "d" (r2) > > #define CALL_FMT_2 CALL_FMT_1, "d" (r3) > > #define CALL_FMT_3 CALL_FMT_2, "d" (r4) > > #define CALL_FMT_4 CALL_FMT_3, "d" (r5) > > This is (slightly) wrong. %r2 is used as the input register for the first argument > and the result value for the call. With your patch you force the compiler to load > the first argument in two registers. One solution would be to CALL_FMT1 as > > #define CALL_FMT1 CALL_FMT_0 > > It still is not optimal though as for CALL_FMT_0 the "+&d" (r2) indicates an > input but CALL_ARGS_0 does not initialize r2. Ok, thanks for taking a closer look! > I am thinking about the following patch to cover all cases: > -- > From 91a4abbec91a9f26f84f7386f2c0f96de669b0eb Mon Sep 17 00:00:00 2001 > From: Martin Schwidefsky > Date: Wed, 10 Apr 2019 15:48:43 +0200 > Subject: [PATCH] s390: fine-tune stack switch helper > > The CALL_ON_STACK helper currently does not work with clang and for > calls without arguments it does not initialize r2 although the contraint > is "+&d". Rework the CALL_FMT_x and the CALL_ON_STACK macros to work > with clang and produce optimal code in all cases. > > Reported-by: Arnd Bergmann > Signed-off-by: Martin Schwidefsky I did another build test to confirm that your patch works fine with clang as well, looks good to me. Arnd