Received: by 10.223.148.5 with SMTP id 5csp7698056wrq; Thu, 18 Jan 2018 08:29:24 -0800 (PST) X-Google-Smtp-Source: ACJfBosF+ajizLoBR7kJ6PIEHQtJbOmjjbjtwTGgs61rA0WxozhGi6QWsKPVdT2nNRT12ivEFNnW X-Received: by 10.101.85.138 with SMTP id j10mr25065219pgs.144.1516292964225; Thu, 18 Jan 2018 08:29:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516292964; cv=none; d=google.com; s=arc-20160816; b=hF+hz2WrcklEoPMBFd6Zc3kcRjmtTG3Gb3IyalwTCwlgVcSQm414d0epEntxkQiSvY V0Nu4IFSuwe0Eg8aDIDtzLa0vUt2W+2b4OYsOiYgqt2NOwCoy83d2UQSMSqHz2u5ewkT jgdAKUZasodgKXL/tFM1ge8lqyvE3JB5Ips19RYYmelnhIjIdVq7ePM/9MjwUB+QyX5z 47AYqxnXCWFFbZfvSI74MynIN9wU5r+dt5YadDrjWg240jjhVniRQDtC9Q2PO8KPdKwK AgLs26/JczdddHuWQKBc05bACRhbhO/J9Aw3nbLCMiLPXOX8QYJo1KD0wMH60n10Bzfs OhPw== 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:dmarc-filter :arc-authentication-results; bh=TDIZAwuxReCHlTFETIqabI8pHAC04Km8DeGzsdmTZnY=; b=UhnksO3KyFw6uaz5qbaJdsP8KLNbPc80Anjfv5QEq8VOoGyl/cT4FMlmxCYr63Jahk lZ4LEHtf8lEsIVcLQP5645wr8CiW9X53AOI6ma/Y3GwooHcPddec1RJPLyd2PIwVhmOH ABtf8657TCry1syhyl6qmokZDDThCYRt55+BQLobL9+Qv4HDFluLCdDtKpi4FYFIr3lV fdF5VBW5/1cQ5O1A8sSUgFGDKb+nH3Te5GeIk18U0979OLJkrkf5sR+G3YhkaB9YmRlE ay5TRiKpoNtbRCkci6Z74eTE+0G5xVwP5/sSs5DQN8ZesEnT7Y7y822ipSsmqwEnNGjN qNwg== 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 q22si7045920pff.200.2018.01.18.08.29.10; Thu, 18 Jan 2018 08:29:24 -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 S932962AbeARPzZ (ORCPT + 99 others); Thu, 18 Jan 2018 10:55:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:49182 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932668AbeARPy6 (ORCPT ); Thu, 18 Jan 2018 10:54:58 -0500 Received: from [192.168.0.20] (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 91E3F21742; Thu, 18 Jan 2018 15:47:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 91E3F21742 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=kbingham@kernel.org Subject: Re: [PATCH] scripts/gdb: fix get_thread_info To: Jan Kiszka , Xi Kangjie , Andrew Morton Cc: linux-kernel@vger.kernel.org References: <20180118210159.17223-1-imxikangjie@gmail.com> From: Kieran Bingham Message-ID: <782503b9-83fc-6a47-24ba-524a728da642@kernel.org> Date: Thu, 18 Jan 2018 15:47:31 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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+ ? Regards -- Kieran