Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2291230imm; Thu, 19 Jul 2018 17:28:09 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe4A1iNj3+WBBUxpi0+yS2ulqA7YYfMC9roBZ7T9qOzOTEiEne10TTabH/GXuTv04S7edl0 X-Received: by 2002:a62:3b89:: with SMTP id w9-v6mr11627125pfj.80.1532046489319; Thu, 19 Jul 2018 17:28:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532046489; cv=none; d=google.com; s=arc-20160816; b=bHkNaHTs9DUmyZDOzrcc1Te4YVriYr78BQIQtAZ6IPGnWnnnw1VfXYjOM2tmqHWqEg vyjsK1dGgVnAYQL/GZD5ng4115ojmqiwKjm6dA/f5dAi6WgepjANOlPu/P+w1ZI8PkPL yDh3bfloc8n67gdJlMzNoEpuwxPJ/+CwKvb5FMmSsF+UsLpez0c8AhuLt5XIZBz1WE+6 tb5OKNTqTwTgv11uwR6zpMP+rUcThciVcRqKTcdImrqa5UYNn9VAiqTuZsVYB1bD47LS iegBrb51K3d6lBKGdr1AEDRrGkxkSmH2JeRma5APkQeMQgyPjm88mmzv3Ptrbu4DFXIq tibg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=rbqaWzvQkzIrnemKdr6YR6OBMNnz5UGK+SXL79Zqz+s=; b=m9trKdNNzgPY60dn0a/VGUeuvthCQI/ZbqFuuQv9Ciy2m9m2GZMIodzim3I+VhyHh2 7Am5WQyM+3LdYLj5NBlHGHH5u2n4Vwx1qbm9l/TMcN9g7k4DF+8iEMOHRRX8OeFgYlLp YrCpBPbyGh4qAD9l36ac+tTmp9phBRYUJP/nURdEvkqqzJ1qvU573/+z/xmFCvj/9Woy JNhmHjuJjF3fTirFv7l/S/s7q6FUq4/iLtZaIE6gCd6qSoZ4OzRkawe5HUPVUn5D9dBT Dqje/vAC+SQGuUBwj6OUUHDR0TsM9ZuYzsQhYOWVgim9vcvMO2euzEZGAgTowLIXbXe4 T6YA== 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 n16-v6si480180pgl.596.2018.07.19.17.27.54; Thu, 19 Jul 2018 17:28:09 -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 S1731144AbeGTBMs convert rfc822-to-8bit (ORCPT + 99 others); Thu, 19 Jul 2018 21:12:48 -0400 Received: from ozlabs.org ([203.11.71.1]:33515 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730798AbeGTBMs (ORCPT ); Thu, 19 Jul 2018 21:12:48 -0400 Received: from localhost.localdomain (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 41WsCM090qz9s4r; Fri, 20 Jul 2018 10:27:11 +1000 (AEST) Received: by localhost.localdomain (Postfix, from userid 1000) id B9F28EE78BF; Fri, 20 Jul 2018 10:27:10 +1000 (AEST) Message-ID: <1205bfc10c62986b4345fa258cf37e820c08226b.camel@neuling.org> Subject: Re: [RESEND][PATCH] powerpc/powernv : Save/Restore SPRG3 on entry/exit from stop. From: Michael Neuling To: ego@linux.vnet.ibm.com Cc: Michael Ellerman , Benjamin Herrenschmidt , Vaidyanathan Srinivasan , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Florian Weimer , Oleg Nesterov Date: Fri, 20 Jul 2018 10:27:10 +1000 In-Reply-To: <20180718081249.GA17700@in.ibm.com> References: <1531826849-31838-1-git-send-email-ego@linux.vnet.ibm.com> <1531843216-22209-1-git-send-email-ego@linux.vnet.ibm.com> <80bbdf47081e3e302ab5f28b5ddc9e2faabba842.camel@neuling.org> <20180718081249.GA17700@in.ibm.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Mailer: Evolution 3.28.1-2 Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2018-07-18 at 13:42 +0530, Gautham R Shenoy wrote: > Hello Mikey, > > On Wed, Jul 18, 2018 at 09:24:19AM +1000, Michael Neuling wrote: > > > > > DEFINE(PPC_DBELL_SERVER, PPC_DBELL_SERVER); > > > diff --git a/arch/powerpc/kernel/idle_book3s.S > > > b/arch/powerpc/kernel/idle_book3s.S > > > index d85d551..5069d42 100644 > > > --- a/arch/powerpc/kernel/idle_book3s.S > > > +++ b/arch/powerpc/kernel/idle_book3s.S > > > @@ -120,6 +120,9 @@ power9_save_additional_sprs: > > > mfspr r4, SPRN_MMCR2 > > > std r3, STOP_MMCR1(r13) > > > std r4, STOP_MMCR2(r13) > > > + > > > + mfspr r3, SPRN_SPRG3 > > > + std r3, STOP_SPRG3(r13) > > > > We don't need to save it. Just restore it from paca->sprg_vdso which should > > never change. > > Ok. I will respin a patch to restore SPRG3 from paca->sprg_vdso. > > > > > How can we do better at catching these missing SPRGs? > > We can go through the list of SPRs from the POWER9 User Manual and > document explicitly why we don't have to save/restore certain SPRs > during the execution of the stop instruction. Does this sound ok ? > > (Ref: Table 4-8, Section 4.7.3.4 from the POWER9 User Manual > accessible from > https://openpowerfoundation.org/?resource_lib=power9-processor-users-manual) I was thinking of a boot time test case built into linux. linux has some boot time test cases which you can enable via CONFIG options. Firstly you could see if an SPR exists using the same trick xmon does in dump_one_spr(). Then once you have a list of usable SPRs, you could write all the known ones (I assume you'd have to leave out some, like the PSSCR), then set the appropriate stop level, make sure you got into that stop level, and then see if that register was changed. Then you'd have an automated list of registers you need to make sure you save/restore at each stop level. Could something like that work? Mikey