Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2829879pxb; Mon, 19 Apr 2021 15:22:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgyCKc3iY+1M5Sly5WXW9TU5jDCHFC9+9KHGou7NkFHCv/PMoD0iCh9gMrur88iCkZ/iTi X-Received: by 2002:a17:906:b01:: with SMTP id u1mr24709657ejg.310.1618870937524; Mon, 19 Apr 2021 15:22:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618870937; cv=none; d=google.com; s=arc-20160816; b=XxmN8is81TuDNsouKzb3iVZHYKY19KHH1GXMzdr+RlFBk2wFDEVQnKEWrSBOrL+aL8 6aMwJU4YBVy2kxy+dMNBjRgR03JNNq1+uQ1eE6RsrPG556pprwSs68ePI8yhOQ5bcaEx O2H+YmqDdYRtOD5QjclgqcrVL4gDKa+80W1DVeOcMVUHVo3cuTkrndE3oAznP5RWrZox itGHeJVBBKLcINPClWD3OXYVOAJYfvQFcYRHX7zPKZpI7YYnBnHhUYLNywQ5b4d+nZb/ 6DOK5DzvACVkVP+D0EuXwBtY2/0hv/hSCovr+x2ttpfQPLfJaVMiLFYQzHSgyXmJc7lC FhiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zPw8pJopQk35J8yAQ1PRyZiRq6ZPmFzHWy5vKhsJNSc=; b=ay82bIf8QTG1ox7Cndr7YQZ2YmEyOnRZNtG3k2nHhLz4NyPk7Ogwol4IO6CXH9WS6J uo3msVFuKCtKluWSi/6Pgd7GNFINPUQ6zBFhuP+vPhwLgyxDxXaDJSbcMsZMtK8ma1RX Vr8DlIx1xu0jbDrgF+R2rrIeFjpQuuKh+cTSvnKUhlQsBZaK98vHtBTFoVc5YflaRlKO s0dOXdlSWCugr6wy/Xs0kI4qrmHOKpesAhtZaTziBEf8qcG9ugPwIeiJ+vU6SnZe8LXX D28b/c5OhNsv2mg6S+euGlFVr19KRBCU6RvpOykNEIvnC7SuEQMDrhdk/yGbG1pUkqS6 220g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NnZq8bVv; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u22si12818585eje.506.2021.04.19.15.21.54; Mon, 19 Apr 2021 15:22:17 -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=@kernel.org header.s=k20201202 header.b=NnZq8bVv; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242507AbhDSUpN (ORCPT + 99 others); Mon, 19 Apr 2021 16:45:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:54130 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242392AbhDSUod (ORCPT ); Mon, 19 Apr 2021 16:44:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0BA8961104; Mon, 19 Apr 2021 20:44:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618865042; bh=YlKAKyKIsnMUVvz5L53H8DTYTlwH5RuaUg2xCn3wFPw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NnZq8bVvBfjMO7c1fxYtX6eS56lRfRlUAH6/TEmqYM3awiyZmlE2G4H86/qilchKh rnMoLHCY33fxgMR2f2I0gCHPhAmAmGo1kiypTHDkz7+0o4SFmJRw01R2IInRflKoYz HwCFvNlZjt3/cPl5+JF9oBZaYZuu7KC9Ao6y83tiVtZxf8CEjeaKhZdgEZoqokDaaL 9Mry1JhSG9FgqsdlBv8VuLSOBI1VoPf4/vYk05pfd90g4EbgfRli0f9Q8AQs4cTx40 EvcCkVilxNTZaXKMVsJE4YAsHFN2nvIRom8Bjdg9+Yv4yZpTwalHQatd8AQPhTmF+H gzTJaHTYTFcpw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Vasily Gorbik , Sven Schnelle , Heiko Carstens , Sasha Levin , linux-s390@vger.kernel.org Subject: [PATCH AUTOSEL 5.11 13/23] s390/entry: save the caller of psw_idle Date: Mon, 19 Apr 2021 16:43:32 -0400 Message-Id: <20210419204343.6134-13-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210419204343.6134-1-sashal@kernel.org> References: <20210419204343.6134-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vasily Gorbik [ Upstream commit a994eddb947ea9ebb7b14d9a1267001699f0a136 ] Currently psw_idle does not allocate a stack frame and does not save its r14 and r15 into the save area. Even though this is valid from call ABI point of view, because psw_idle does not make any calls explicitly, in reality psw_idle is an entry point for controlled transition into serving interrupts. So, in practice, psw_idle stack frame is analyzed during stack unwinding. Depending on build options that r14 slot in the save area of psw_idle might either contain a value saved by previous sibling call or complete garbage. [task 0000038000003c28] do_ext_irq+0xd6/0x160 [task 0000038000003c78] ext_int_handler+0xba/0xe8 [task *0000038000003dd8] psw_idle_exit+0x0/0x8 <-- pt_regs ([task 0000038000003dd8] 0x0) [task 0000038000003e10] default_idle_call+0x42/0x148 [task 0000038000003e30] do_idle+0xce/0x160 [task 0000038000003e70] cpu_startup_entry+0x36/0x40 [task 0000038000003ea0] arch_call_rest_init+0x76/0x80 So, to make a stacktrace nicer and actually point for the real caller of psw_idle in this frequently occurring case, make psw_idle save its r14. [task 0000038000003c28] do_ext_irq+0xd6/0x160 [task 0000038000003c78] ext_int_handler+0xba/0xe8 [task *0000038000003dd8] psw_idle_exit+0x0/0x6 <-- pt_regs ([task 0000038000003dd8] arch_cpu_idle+0x3c/0xd0) [task 0000038000003e10] default_idle_call+0x42/0x148 [task 0000038000003e30] do_idle+0xce/0x160 [task 0000038000003e70] cpu_startup_entry+0x36/0x40 [task 0000038000003ea0] arch_call_rest_init+0x76/0x80 Reviewed-by: Sven Schnelle Signed-off-by: Vasily Gorbik Signed-off-by: Heiko Carstens Signed-off-by: Sasha Levin --- arch/s390/kernel/entry.S | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S index f1ba197b10c0..f0a215cf010c 100644 --- a/arch/s390/kernel/entry.S +++ b/arch/s390/kernel/entry.S @@ -976,6 +976,7 @@ ENDPROC(ext_int_handler) * Load idle PSW. */ ENTRY(psw_idle) + stg %r14,(__SF_GPRS+8*8)(%r15) stg %r3,__SF_EMPTY(%r15) larl %r1,.Lpsw_idle_exit stg %r1,__SF_EMPTY+8(%r15) -- 2.30.2