Received: by 10.223.148.5 with SMTP id 5csp7701342wrq; Thu, 18 Jan 2018 08:31:12 -0800 (PST) X-Google-Smtp-Source: ACJfBouHm0nSqpTCQqsYzgdKqU5xhQLwqfFix+3vepBKKfDOoLmi2IllzTYJbkSP2ahjAM8Tl8R3 X-Received: by 10.98.159.25 with SMTP id g25mr15543539pfe.224.1516293072031; Thu, 18 Jan 2018 08:31:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516293071; cv=none; d=google.com; s=arc-20160816; b=RLLIVFxKH57smhHTznGb6+FxoNdqljXOCX7YsvkMMNPjBVFyMEXKW+LTnRkhEjTWlh MLrPDCOAd2MAO1nOoWko2lpwdL3EdJykyQacm/E6UgEi2nr/M7X4PsqWBNpRcILaSRbv dLkyH1frYIFmwooq2DClwlcLDoyxGW/PzD4LaiJD6MJMcJGadDyEpWTXH6SamKQQ3Gzp 1R+O6Ru7Tl6D6NvGSSacGIESL5/5mk+DRmXcVrMa/2iGIOe89D0lfPu9Xfbz+jvxagx3 qehGPvS58MD19fiVKnIOCxF2lgrsYCRmOtdHafts3vO6mQgAC3rf/rhQ5HWkjZcWfYRH xRtQ== 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:arc-authentication-results; bh=mdF+Q5pl3bnrJIHYNcULqllmw2hNlUB3JRR3enm24A0=; b=PSmHzaPyk2bxdaSQTKMolClzptItkmrfSH0l4C+gSn0ekSsPsmev1NKglSk7LXcrMX EhXvUsOkYM1aLskDQqHU3z4Lg8ti2FUKlxRFv9eaFRzzRmA5oQGqzh5kSbmhylRVIaFN nqxCRfW+nKONOPKXjzPDKHFtHantjWhuvuBLqHK/oGX7rRWULiaWm1bNDkBbFwe6yxz1 g3LGho29P2EMW8oXoBKPi/kjyFMZbLrE6uPsLQ+12Nz7xz6fuJoGlEUTLEob8ntgSgkC MpwEdCvoks9MfYiFysikE5Vx+kbHMwCljeOc0TJ6LRaBNoeyUB7epTcaB6e6MN2i1B+5 vQDg== 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 m3si6386055pgc.323.2018.01.18.08.30.58; Thu, 18 Jan 2018 08:31:11 -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 S1755274AbeARQJp (ORCPT + 99 others); Thu, 18 Jan 2018 11:09:45 -0500 Received: from thoth.sbs.de ([192.35.17.2]:56650 "EHLO thoth.sbs.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753406AbeARQJo (ORCPT ); Thu, 18 Jan 2018 11:09:44 -0500 X-Greylist: delayed 678 seconds by postgrey-1.27 at vger.kernel.org; Thu, 18 Jan 2018 11:09:44 EST Received: from mail2.siemens.de (mail2.siemens.de [139.25.208.11]) by thoth.sbs.de (8.15.2/8.15.2) with ESMTPS id w0IFoM4O020032 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 18 Jan 2018 16:50:22 +0100 Received: from md1f2u6c.ww002.siemens.net ([144.145.53.21]) by mail2.siemens.de (8.15.2/8.15.2) with ESMTP id w0IFoMO5014099; Thu, 18 Jan 2018 16:50:22 +0100 Subject: Re: [PATCH] scripts/gdb: fix get_thread_info To: Kieran Bingham , Xi Kangjie , Andrew Morton Cc: linux-kernel@vger.kernel.org References: <20180118210159.17223-1-imxikangjie@gmail.com> <782503b9-83fc-6a47-24ba-524a728da642@kernel.org> From: Jan Kiszka Message-ID: <273f82e8-7419-a636-c7d3-a0857b478ade@siemens.com> Date: Thu, 18 Jan 2018 16:50:21 +0100 User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 In-Reply-To: <782503b9-83fc-6a47-24ba-524a728da642@kernel.org> Content-Type: text/plain; charset=utf-8 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 2018-01-18 16:47, Kieran Bingham wrote: > > On 18/01/18 15:43, Jan Kiszka wrote: >> On 2018-01-18 22:01, Xi Kangjie wrote: >>> Since kernel 4.9, the thread_info has been moved into task_struct, >>> no longer locates at the bottom of kernel stack. >>> >>> See commits: >>> - commit c65eacbe290b ("sched/core: Allow putting thread_info into >>> task_struct") >>> - commit 15f4eae70d36 ("x86: Move thread_info into task_struct") >>> >>> Before fix: >>> (gdb) set $current = $lx_current() >>> (gdb) p $lx_thread_info($current) >>> $1 = {flags = 1470918301} >>> (gdb) p $current.thread_info >>> $2 = {flags = 2147483648} >>> >>> After fix: >>> (gdb) p $lx_thread_info($current) >>> $1 = {flags = 2147483648} >>> (gdb) p $current.thread_info >>> $2 = {flags = 2147483648} >>> >>> Signed-off-by: Xi Kangjie >>> --- >>> scripts/gdb/linux/tasks.py | 2 ++ >>> 1 file changed, 2 insertions(+) >>> >>> diff --git a/scripts/gdb/linux/tasks.py b/scripts/gdb/linux/tasks.py >>> index 1bf949c43b76..f6ab3ccf698f 100644 >>> --- a/scripts/gdb/linux/tasks.py >>> +++ b/scripts/gdb/linux/tasks.py >>> @@ -96,6 +96,8 @@ def get_thread_info(task): >>> thread_info_addr = task.address + ia64_task_size >>> thread_info = thread_info_addr.cast(thread_info_ptr_type) >>> else: >>> + if task.type.fields()[0].type == thread_info_type.get_type(): >>> + return task['thread_info'] >>> thread_info = task['stack'].cast(thread_info_ptr_type) >>> return thread_info.dereference() >>> >>> >> >> Acked-by: Jan Kiszka >> >> Andrew, please pick up. > > Acked-by: Kieran Bingham > > However, should we mark this as: > Cc: # 4.9+ ? > Yes, good point. Jan -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux