Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3163085pxk; Tue, 15 Sep 2020 11:39:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAYC4Nk2sFr1fhyx01NSzkcCfDgXVc/J8lcbcgx/8YPpHT/AmB3xc67qUT+bg9yfuiL+2+ X-Received: by 2002:a17:906:288d:: with SMTP id o13mr22283037ejd.195.1600195199526; Tue, 15 Sep 2020 11:39:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600195199; cv=none; d=google.com; s=arc-20160816; b=JmeyHEAlWu722Adypa5tE7HRQmcmdMSUAiNS4NcEUc/4CLr7KzPtYo24ukMp0Qny2P qmrEpm2bSpSWy3op0donnFssH5xmRyUoFgFeA/Q7svLARmZL6pXi9m/z4OKklqA3qE4h Pr5g8mx/Y6kbrcAouwGa6NFo/P0nfC+9oqqHOOQuFlyx3FS7ftw4P1roJKEkNW9hRnMr Mi8lpLWWqM7IuRkzpMNl8gTh+yshwetdoQwAthQRjnvSYHkJ+ph5dP1vITxLhdPiymvY cVZzV8+mzkE6nTMbqd77enDcu1rwBf8poeROQaF6g/1r/cf8HEPsyl82l8l5O2Y8FC/L ooOQ== 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:dkim-signature; bh=2zoHbkMZFFhAGDLD6+oRaQAq0ZiYfkwGQ2rEJMY8yX0=; b=f3OBXtbhCzf5Oy4+VtMyToK3J5ox7wLoTICD+WRdDa8YYfX3ORRkl+klUM1F1PhrOE UWDZq5uWYlXCSaIq6wnEnB+Orm/gJgytwMR1FQj0NmabT6ust9QT0uuThLSKgbMUqTHU pmTOvZ1IL3XZnogJYVBiI7Uism4p0nIVqMfBAbabpHSOsmwOhOBrX/MxMt9VqFDw6zhH 08SPMQI4SpERIMgrvO/Qm8CBHDSD8b+fPrhSoDNoCyH/K/H0JZIopNKBWKS0eeW4h7/m d3QtRqpGRXZwVaiJnOf77yXE/acG0ys4fTs4MDF45IZT4UdEBMwHd/Sefdrz7hdKA+4u 3TMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=f1T9mNnu; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v10si9247996ejx.195.2020.09.15.11.39.36; Tue, 15 Sep 2020 11:39:59 -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=@google.com header.s=20161025 header.b=f1T9mNnu; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727901AbgIOSgu (ORCPT + 99 others); Tue, 15 Sep 2020 14:36:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727887AbgIOSg2 (ORCPT ); Tue, 15 Sep 2020 14:36:28 -0400 Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A319C061788 for ; Tue, 15 Sep 2020 11:36:27 -0700 (PDT) Received: by mail-lf1-x142.google.com with SMTP id q8so4182656lfb.6 for ; Tue, 15 Sep 2020 11:36:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2zoHbkMZFFhAGDLD6+oRaQAq0ZiYfkwGQ2rEJMY8yX0=; b=f1T9mNnu6S7dphLok7aD+ocpHnqQmx7NNA4OT7K8lwQBOq9Xw1nXpHsEd1Dk3wFWJB 54MeFRG6bYhxz2+mBnevnCkrNt7WaN0r85esfwMhDLdkpbP7TSVT6+1YqLtIKRtHLhNH nPbQEGok1fA0j7AygUwMDGUHt3GRZIZ7lIxTWdVu+wxvvcsVoUmV7P9hBIcGQTY7mdvv eEs9z432gLG8QWQ2TRp0Lm3x/IcE7/Rz8XJzh0et9cLYjEm7etRjLEkSFfXwwG0weRBJ 7gcEdYRVj5pyDc/uvU5rErejQqgiwa5I7FsjPnUx+HC9+M7LTAYZJZjqYSLdwDRN4M7T 5ETg== 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=2zoHbkMZFFhAGDLD6+oRaQAq0ZiYfkwGQ2rEJMY8yX0=; b=gw6Jq0OK9cURfdivYqqtVMjHFq4I9M84j9EjwZDtIpgqY04OVfVfnPFDveQA3vqgH4 jyt3yFukPUjekwPwxdM9WcxMT39EuES/lmKrHlC3+rn7hhbh6ArOqtwgG0dS2UTSdQ4V 1sWe0Patm86DjHtlXY229L++40AJLgc9EZXq0Ltlm9L2wkN95AAP+LkZmfUG0PmLJMTb vq5fbf1lfuhnf+oZbbx1xbWaFzsmgXmE/DnQNon0m3w87UuL/yj4l4UPYDQ5eH6Bv/cB pgaw5XhDAvl5UXIuAAyopU9aR7bmTwA9NoqcZ/rU1RtHDPvSg7VkwwZIYZvqI4VuYqoL d9Dg== X-Gm-Message-State: AOAM5325+rpzNt2bMEErthNiKjRDBTZAuq7LcwMJsv184mrrIP7cNX9N jJUz4gxR8a/P4Zsq/RAyuUws/oCzl39exnf6B7JboA== X-Received: by 2002:ac2:511c:: with SMTP id q28mr6128023lfb.411.1600194985320; Tue, 15 Sep 2020 11:36:25 -0700 (PDT) MIME-Version: 1.0 References: <20200915172658.1432732-1-rkir@google.com> <20200915174643.GT14436@zn.tnic> <20200915182730.GW14436@zn.tnic> In-Reply-To: <20200915182730.GW14436@zn.tnic> From: Roman Kiryanov Date: Tue, 15 Sep 2020 11:36:13 -0700 Message-ID: Subject: Re: [PATCH] arch: x86: power: cpu: init %gs before __restore_processor_state (clang) To: Borislav Petkov Cc: rjw@rjwysocki.net, pavel@ucw.cz, Thomas Gleixner , mingo@redhat.com, x86@kernel.org, linux-pm@vger.kernel.org, Greg KH , Nick Desaulniers , Alistair Delva , Haitao Shan , lkml 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 Tue, Sep 15, 2020 at 11:27 AM Borislav Petkov wrote: > > I believe the kernel makes a questionable assumption on how clang > > uses registers (gs will not be used if stack protection is disabled). > > Both kernel and clang behaves unfortunate here. > > If the kernel is at fault here and this same thing happens with GCC, > sure, but this is a clang-specific fix. This is fair. Unfortunately I am not an x86 asm expert. I expect the proper fix should land into arch/x86/kernel/acpi/wakeup_64.S to init %gs (maybe some more registers) before "jmp restore_processor_state". Regards, Roman.