Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1459263ybh; Fri, 13 Mar 2020 01:28:04 -0700 (PDT) X-Google-Smtp-Source: ADFU+vt/RmMFOJTSuywlheattTHnIn18007Z5zFRbuSrRtc6aDKzV40wplw3+x/TLvjz9y1Ohqql X-Received: by 2002:a05:6830:1503:: with SMTP id k3mr10366944otp.28.1584088084727; Fri, 13 Mar 2020 01:28:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584088084; cv=none; d=google.com; s=arc-20160816; b=Y9/OoAdZ58b81NZBZ4mMaTV1T9UW+FcVrnw1h4/vC+1iZGdUCBZeCy6UlbOaKW5RtG EVNExu0gn/RBG5Qe16jqA8hScS2sX3zaWHKfVPRfilS1YgIscYPK5OccKskUwAoXzDVR RTZYA3N2gBjliEfxyFxkBXHD59OrtDW+KaI5jqmRxjWL9VtJAJtxoLiwLe5FepaDZxBD bkdtS+Hwj7t3WfUN3FXUylZENoFRK4/Rt20xlbkHJrlQsd3gPuG0M/KoJTQi0IBFt4pg 71FRIVdvOXJhT66nAF9k0wdmgrPABLQDTs6K0M9gUBlWBTrk6A3VfhAJQefcbbcrJ0ad YGUw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=LwyFuTGxApIAUOlDKD+v37yAR8CAiuVnZRKSgk/Nydw=; b=gra2CXGV6AdcwUDHgm4aDCZIDEx4bnSYULfBVYxRKLd8Pj0jsDMjlTYMqQI+hmW72O JkKYtLU+hS442hgIma/ekYrEdUeR7LQsZSVlI/Vn/gZ9N31Plro2LRM3/F3793QXBtOI JGSmopnNo3+ip1gsvxXMMvVbGiDedxeYJFLl9WWG7FgRB2yfbouO1hAHR6CcO+5y2OcD roEmyFp98Ydr4LkplUrENKR+XMjrHwKucuQ1UyP6k0SbIc2m8iwua373xEAyoqibkJoV BQ//j7HHA4CXdjLZf3SQbKXbRBosqi11Zdrrr1q2neJZ35uPEOfSujSIHL5yuRYrLKlH f3cg== 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 c11si5940764ots.280.2020.03.13.01.27.51; Fri, 13 Mar 2020 01:28:04 -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 S1726483AbgCMI1D (ORCPT + 99 others); Fri, 13 Mar 2020 04:27:03 -0400 Received: from mx2.suse.de ([195.135.220.15]:47248 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726310AbgCMI1C (ORCPT ); Fri, 13 Mar 2020 04:27:02 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 01184B22E; Fri, 13 Mar 2020 08:26:59 +0000 (UTC) Subject: Re: [RFC PATCH 2/2] x86/xen: Make the secondary CPU idle tasks reliable To: Miroslav Benes , boris.ostrovsky@oracle.com, sstabellini@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, jpoimboe@redhat.com Cc: x86@kernel.org, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, jslaby@suse.cz References: <20200312142007.11488-1-mbenes@suse.cz> <20200312142007.11488-3-mbenes@suse.cz> From: =?UTF-8?B?SsO8cmdlbiBHcm/Dnw==?= Message-ID: <75224ad1-f160-802a-9d72-b092ba864fb7@suse.com> Date: Fri, 13 Mar 2020 09:26:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200312142007.11488-3-mbenes@suse.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12.03.20 15:20, Miroslav Benes wrote: > The unwinder reports the secondary CPU idle tasks' stack on XEN PV as > unreliable, which affects at least live patching. > cpu_initialize_context() sets up the context of the CPU through > VCPUOP_initialise hypercall. After it is woken up, the idle task starts > in cpu_bringup_and_idle() function and its stack starts at the offset > right below pt_regs. The unwinder correctly detects the end of stack > there but it is confused by NULL return address in the last frame. > > RFC: I haven't found the way to teach the unwinder about the state of > the stack there. Thus the ugly hack using assembly. Similar to what > startup_xen() has got for boot CPU. > > It introduces objtool "unreachable instruction" warning just right after > the jump to cpu_bringup_and_idle(). It should show the idea what needs > to be done though, I think. Ideas welcome. > > Signed-off-by: Miroslav Benes > --- > arch/x86/xen/smp_pv.c | 3 ++- > arch/x86/xen/xen-head.S | 10 ++++++++++ > 2 files changed, 12 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/xen/smp_pv.c b/arch/x86/xen/smp_pv.c > index 802ee5bba66c..6b88cdcbef8f 100644 > --- a/arch/x86/xen/smp_pv.c > +++ b/arch/x86/xen/smp_pv.c > @@ -53,6 +53,7 @@ static DEFINE_PER_CPU(struct xen_common_irq, xen_irq_work) = { .irq = -1 }; > static DEFINE_PER_CPU(struct xen_common_irq, xen_pmu_irq) = { .irq = -1 }; > > static irqreturn_t xen_irq_work_interrupt(int irq, void *dev_id); > +extern unsigned char asm_cpu_bringup_and_idle[]; > > static void cpu_bringup(void) > { Would adding this here work? + asm volatile (UNWIND_HINT(ORC_REG_UNDEFINED, 0, ORC_TYPE_CALL, 1)); Juergen