From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 85951 invoked by alias); 24 Apr 2017 15:24:43 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 85685 invoked by uid 89); 24 Apr 2017 15:24:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=client's, reservation, facing, H*o:Research X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 24 Apr 2017 15:24:19 +0000 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v3OFJ1ZR090313 for ; Mon, 24 Apr 2017 11:24:10 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0b-001b2d01.pphosted.com with ESMTP id 2a1j097v58-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 24 Apr 2017 11:24:10 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 24 Apr 2017 16:24:09 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 24 Apr 2017 16:24:05 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v3OFO5Jq35324112; Mon, 24 Apr 2017 15:24:05 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 84AD0AE05F; Mon, 24 Apr 2017 16:22:43 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 49BEEAE059; Mon, 24 Apr 2017 16:22:43 +0100 (BST) Received: from oc1027705133.ibm.com (unknown [9.152.212.162]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Mon, 24 Apr 2017 16:22:43 +0100 (BST) From: Andreas Arnez To: Omair Javaid Cc: Philipp Rudo , "gdb-patches\@sourceware.org" , Yao Qi , Peter Griffin , Lee Jones , Russell Wayman Subject: Re: [RFC v3 3/8] Add basic Linux kernel support References: <20170316165739.88524-1-prudo@linux.vnet.ibm.com> <20170316165739.88524-4-prudo@linux.vnet.ibm.com> Date: Mon, 24 Apr 2017 15:24:00 -0000 In-Reply-To: (Omair Javaid's message of "Thu, 20 Apr 2017 16:08:57 +0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-GCONF: 00 x-cbid: 17042415-0020-0000-0000-000003501D7D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17042415-0021-0000-0000-0000416BB678 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-04-24_12:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1704240263 X-IsSubscribed: yes X-SW-Source: 2017-04/txt/msg00650.txt.bz2 On Thu, Apr 20 2017, Omair Javaid wrote: > Hi Philipp and Andreas, > > I have some further comments on this patch specifically about copying > task_struct->pid into ptid->lwp and using task_struct address as tid. > > I see that we are overriding lwp, tid which any target beneath might > be using differently. > > So suggestion about storing task_struct->pid or task_struct address is > to use private_thread_info in binutils-gdb/gdb/gdbthread.h for this > information. The current version of the patch series is mainly focused on dump targets. Remote targets require some additional changes. We've discussed the use of private_thread_info before, and the last I've seen is that it is not suitable either, because remote.c uses it already: https://sourceware.org/ml/gdb-patches/2017-02/msg00543.html In my view, the private_thread_info field really is a hack, and we are now facing its limits. It provides some space for a single thread layer to store information into, but not for multiple such layers. In the case of the Linux kernel we at least have two different thread layers: the CPU layer (each "thread" is a CPU), and the kernel task layer on top of that. I think we need to allow a target to maintain its *own* thread list. The CPU "thread list" would be maintained by the target beneath (remote/dump), and the kernel task list would be maintained by the LK target. The ptid namespaces could be completely separate. > I also have reservation about use of old_ptid naming in struct > lk_private and struct lk_ptid_map. > > old_ptid naming is a little confusing kindly choose a distinguishable > name for old_ptid varibles in both lk_private and lk_ptid_map. > > Further Here's an implementation of bitmap_weight function from linux > kernel. Kindly see if your implementation can be improved and moved to > a generic area in gdb. > > 10 int __bitmap_weight(const unsigned long *bitmap, int bits) > 11 { > 12 int k, w = 0, lim = bits/BITS_PER_LONG; > 13 > 14 for (k = 0; k < lim; k++) > 15 w += hweight_long(bitmap[k]); > 16 > 17 if (bits % BITS_PER_LONG) > 18 w += hweight_long(bitmap[k] & BITMAP_LAST_WORD_MASK(bits)); > 19 > 20 return w; > 21 } The __bitmap_weight function is specific to Linux, so I'm not sure we want to move it to a generic area. For big-endian targets the function depends on the width of Linux' "unsigned long" type, because BITMAP_LAST_WORD_MASK builds a mask for the *least significant* bits instead of the *lowest-addressed* ones. It's probably true that the performance of lk_bitmap_hweight could be improved. For instance, with some care a function like popcount_hwi() in GCC's hwint.h could be exploited, even if the target's word width and byte order may not match the GDB client's. This would not make the function simpler, though. -- Andreas