Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp296038ybk; Fri, 15 May 2020 00:34:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzZpRKmHlonszrcZV7oHj16PzYJKOb1VD/KfxzFZX+qd8wXCfhZ5agsb5IaOfNK2/FlrGt X-Received: by 2002:aa7:d84e:: with SMTP id f14mr1596811eds.195.1589528064921; Fri, 15 May 2020 00:34:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589528064; cv=none; d=google.com; s=arc-20160816; b=UUjlSQ9L1Ldss+RjNj/V3S0tuzHdbPWHE38wTOanxQH+9YbtToiF/jkCpwciwoYMD7 Dol4iMhUxBujHn/KqRr+H7geld0Jb+0Fe20+Zm+W/SEjpJzvRb5YOmT88g07O+TUNPHJ 9hLp0HG7Uw1hL2bo4jbmLi3Ps71nq6XnuFPy+aXhdfQYvRffkdnacSnZxF0pPVwiVqQE QhToJEa/n6KsdmZvA+1Yg3Uv0/v2OA44yhq4nqDCl0ZvsjveY5rLT9jpaL9j+Sz80Sjg 3dOL/dEjOq26c7gFsx1C/KrJdr3q0ilFbXTU63Qrk+V8KAkCtJuVniRY6tWiS+J521Vo G2MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:message-id :mime-version:in-reply-to:references:cc:to:subject:from:date :dkim-signature; bh=Zry/fghQEm9+2SmdAD9KYKq3yHSvQsjUQtQVB34xriA=; b=E0xpsEdFGFoyYon9XntazvLa8Un3+8GqZvRghGvOi5YyX5iB/upkPT3Io8kVEQDSYu a1Juago0sBG1/T2Hn8mKdehFj9l80R18NaFmRPUZpqnP1ESZ1fm1VbwmEFjrN3mq8iGi ZqWv0X70W6qDmAejig+BFoUqq51Y1yN7CqIy0v07gWLm8FHNlmknob/pGCXuQC4rvBFj v7ASstc8Px0nZ65HxGSiKLLv+y+QRZ6eW+e+85H087f4uLXF71IayR9XJzlrd1P0f74c NdxwQDKHokAVjyM/+NH/xv5wqoeHQtiKpq3jgfoq1BO3V9F2tn9iYUKLyfeicttEkXVI xS7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SHm0yMQt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m60si666098ede.128.2020.05.15.00.34.01; Fri, 15 May 2020 00:34:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SHm0yMQt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726720AbgEOHaS (ORCPT + 99 others); Fri, 15 May 2020 03:30:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726434AbgEOHaR (ORCPT ); Fri, 15 May 2020 03:30:17 -0400 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BC25C061A0C for ; Fri, 15 May 2020 00:30:17 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id l73so3720524pjb.1 for ; Fri, 15 May 2020 00:30:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:subject:to:cc:references:in-reply-to:mime-version :message-id:content-transfer-encoding; bh=Zry/fghQEm9+2SmdAD9KYKq3yHSvQsjUQtQVB34xriA=; b=SHm0yMQt7M+jtPhtNKafVJznR2euW6fSXaD469u9JcMFSiDRJhy5vfa66OiUnAVWdS Kf8+t8fk9waQwBCVM3cVql0YoCJeGk/vEv0ZRnNgjDUiLKlZ1yLOq07q8KMnuS53iN3u haQHu6aK2wZizHrgHEz8ObRTVcKM6jpXeONA1N2lWrjedIzYEaJ7u8E7lXqIMJcJTPa0 waHhBTmbKqcuVBHo20mOU/J5nprfCNRe938LDJGGLWyMMf61DX88W501kIkcbqjcvZQ/ TffY7/gDQRqo3iHgtb3gpirbUf01RYvHC+bmHFh5MWJaoHWryjRZNLgsnJ92bYOJy36n nKrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=Zry/fghQEm9+2SmdAD9KYKq3yHSvQsjUQtQVB34xriA=; b=QQfrUzw6Fpme+IDQsJagi7ndzyYqee+tcicFbxwiq3fUOWyDK90dXxCxzxtr0EXiiG jlA/SxltewQ+GPtmK1nDyrhN+2idIkCVW9moMjxbaoZNuQUcIKeNmpgCF++x/GlEcHS6 ZN1slz9zDZMp7sk8yaH8XUTV0o3CbKU3Xun/5rmSbnrIZNiGwa9dJ2qXD9WdJfoAtDO/ KSwkDCzU/KLBKv4iBULsjITTWtYeiKOOamOArbQTbOPJk0p+dbnlkMpfZ416qkZJQ+hc inCmxkPHzXWLWgasAbQKLcPFcqBLBRwlZM2y4/BMXNDWg23wJWQiWUjMnzkixAou4mUG 6knA== X-Gm-Message-State: AOAM530ffan6/zsXaLc1JElDljkz3veCTGXrLn3jY/dK/aowb7Fm0cRq 0bcwA9Ot46p+d5ytek8gppI= X-Received: by 2002:a17:902:fe8d:: with SMTP id x13mr2452917plm.198.1589527816555; Fri, 15 May 2020 00:30:16 -0700 (PDT) Received: from localhost ([61.68.67.54]) by smtp.gmail.com with ESMTPSA id b16sm1168625pfp.89.2020.05.15.00.30.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 00:30:16 -0700 (PDT) Date: Fri, 15 May 2020 17:30:09 +1000 From: Nicholas Piggin Subject: Re: [PATCH v4 2/2] powerpc/rtas: Implement reentrant rtas call To: Allison Randal , Benjamin Herrenschmidt , "Gautham R. Shenoy" , Greg Kroah-Hartman , Leonardo Bras , Michael Ellerman , Nadav Amit , Nathan Lynch , Paul Mackerras , Thomas Gleixner Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org References: <20200514235138.150722-1-leobras.c@gmail.com> <20200514235138.150722-3-leobras.c@gmail.com> In-Reply-To: <20200514235138.150722-3-leobras.c@gmail.com> MIME-Version: 1.0 Message-Id: <1589525800.2asfsw2zlu.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Excerpts from Leonardo Bras's message of May 15, 2020 9:51 am: > Implement rtas_call_reentrant() for reentrant rtas-calls: > "ibm,int-on", "ibm,int-off",ibm,get-xive" and "ibm,set-xive". >=20 > On LoPAPR Version 1.1 (March 24, 2016), from 7.3.10.1 to 7.3.10.4, > items 2 and 3 say: >=20 > 2 - For the PowerPC External Interrupt option: The * call must be > reentrant to the number of processors on the platform. > 3 - For the PowerPC External Interrupt option: The * argument call > buffer for each simultaneous call must be physically unique. >=20 > So, these rtas-calls can be called in a lockless way, if using > a different buffer for each cpu doing such rtas call. What about rtas_call_unlocked? Do the callers need to take the rtas=20 lock? Machine checks must call ibm,nmi-interlock too, which we really don't=20 want to take a lock for either. Hopefully that's in a class of its own and we can essentially ignore with respect to other rtas calls. The spec is pretty vague too :( "The ibm,get-xive call must be reentrant to the number of processors on=20 the platform." This suggests ibm,get-xive can be called concurrently by multiple processors. It doesn't say anything about being re-entrant against any=20 of the other re-entrant calls. Maybe that could be reasonably assumed, but I don't know if it's reasonable to assume it can be called=20 concurrently with a *non-reentrant* call, is it? > For this, it was suggested to add the buffer (struct rtas_args) > in the PACA struct, so each cpu can have it's own buffer. You can't do this, paca is not limited to RTAS_INSTANTIATE_MAX. Which is good, because I didn't want you to add another 88 bytes to the=20 paca :) Can you make it a pointer and allocate it separately? Check the slb_shadow allocation, you could use a similar pattern. The other option would be to have just one more rtas args, and have the=20 crashing CPU always that. That would skirt the re-entrancy issue -- the concurrency is only ever a last resort. Would be a bit tricker though. Thanks, Nick