Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4895482ybl; Tue, 4 Feb 2020 04:02:48 -0800 (PST) X-Google-Smtp-Source: APXvYqwx3dlLj9g2WbolfUOpgYSs5vkUqEEENQZiSnQD25p1Xi7zbK9Pz0hep865MIx4Z6wGGg0U X-Received: by 2002:a05:6830:1248:: with SMTP id s8mr21759393otp.202.1580817768750; Tue, 04 Feb 2020 04:02:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580817768; cv=none; d=google.com; s=arc-20160816; b=FLQG93MzbNQ+rX4R6Xryl3kf/O73VhJKOZB/qj5MMRZEJVkVqgX6VP+WkEuy3OVwhc XCGFOICBiWrkI/9inBpS3GFi2Hka+bZ3Dj2neoQuvJCf62onhqPen2BbAy+N4vmzCnDf NDUbwEn9EIcvWLGOEZEOVChN78OAJBYXNkRMYi0igdEGITZzobrZ5wTP/CsKpMtHFFVB sNrRSCc3Y5U9V5VsMjxWoFDFS3E2vhXWLv+vAFvUimZ8mXiNU+3NUzDo8Ym6QcJx+mhe 6iEJPfEx7l0TBQ0F+vuYlYFwYcd490LfAE3BIkrtoBAh+zexNY555hJB/sv909Nljpkp FMSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:subject:cc:from:to :in-reply-to; bh=/lN3qK11zKk0u0nA2z6yrvB+MLCrxs7drhEoy2/UEZ8=; b=ehLMS2yEmQmFLwy/oYlI7n9Gf1XylvqH1Y4KT0KJhudtOFpZnbKKumaS49lOdeGQX6 p9G/SpZibJiO4JOqCg42i03cd46fK+w5haP31+Aavh2m1FJigPTRr+BK+W6hu1vqeRve hYgPBpaFRIwPgXvWQBV3r9j2nz8eUnsS1fmN2PQeWG2qIZJLjgpFJQfvlDql+DvEPChN 52OwDD0I7ckIZSDX6GrP7f5U/QUgYV0Ro4i0ZUFxwZzHYwhASymm5uD7BE20ovvEmiHi T6Qs5k1Zcllg7YqmxZtUKXSu+wzVSrdw2a4Nxq36Q5EkVXa36bzVJWxAuprEo+2lJYED xUsA== 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 o7si11499699otk.185.2020.02.04.04.02.35; Tue, 04 Feb 2020 04:02:48 -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 S1727223AbgBDMBh (ORCPT + 99 others); Tue, 4 Feb 2020 07:01:37 -0500 Received: from ozlabs.org ([203.11.71.1]:51413 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727148AbgBDMBg (ORCPT ); Tue, 4 Feb 2020 07:01:36 -0500 Received: by ozlabs.org (Postfix, from userid 1034) id 48BjwG5Y3xzB3wq; Tue, 4 Feb 2020 23:01:34 +1100 (AEDT) X-powerpc-patch-notification: thanks X-powerpc-patch-commit: 9933819099c4600b41a042f27a074470a43cf6b9 In-Reply-To: <6d02c3ae6ad77af34392e98117e44c2bf6d13ba1.1580121710.git.christophe.leroy@c-s.fr> To: Christophe Leroy , Benjamin Herrenschmidt , Paul Mackerras From: Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] powerpc/32s: Fix CPU wake-up from sleep mode Message-Id: <48BjwG5Y3xzB3wq@ozlabs.org> Date: Tue, 4 Feb 2020 23:01:34 +1100 (AEDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2020-01-27 at 10:42:04 UTC, Christophe Leroy wrote: > Commit f7354ccac844 ("powerpc/32: Remove CURRENT_THREAD_INFO and > rename TI_CPU") broke the CPU wake-up from sleep mode (i.e. when > _TLF_SLEEPING is set) by delaying the tovirt(r2, r2). > > This is because r2 is not restored by fast_exception_return. It used > to work (by chance ?) because CPU wake-up interrupt never comes from > user, so r2 is expected to point to 'current' on return. > > Commit e2fb9f544431 ("powerpc/32: Prepare for Kernel Userspace Access > Protection") broke it even more by clobbering r0 which is not > restored by fast_exception_return either. > > Use r6 instead of r0. This is possible because r3-r6 are restored by > fast_exception_return and only r3-r5 are used for exception arguments. > > For r2 it could be converted back to virtual address, but stay on the > safe side and restore it from the stack instead. It should be live > in the cache at that moment, so loading from the stack should make > no difference compared to converting it from phys to virt. > > Fixes: f7354ccac844 ("powerpc/32: Remove CURRENT_THREAD_INFO and rename TI_CPU") > Fixes: e2fb9f544431 ("powerpc/32: Prepare for Kernel Userspace Access Protection") > Cc: stable@vger.kernel.org > Signed-off-by: Christophe Leroy Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/9933819099c4600b41a042f27a074470a43cf6b9 cheers