Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5173210img; Wed, 27 Mar 2019 03:38:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqw5OOuvbfB3GHpl1LH+DBgnoetHnCuxNrAXCnwFExuW3bZ5zbGt7cj84qqWjICZduhT4A4e X-Received: by 2002:a62:a515:: with SMTP id v21mr27352495pfm.41.1553683130865; Wed, 27 Mar 2019 03:38:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553683130; cv=none; d=google.com; s=arc-20160816; b=usg/JHoB0YC5Glsb4HdCBa9Pm3BHLKc3mhIXNxiFUqGa/OGjpbfr97ua3IRdNnLkA4 5bTaUQ0zbNUR3C9ZOqHCfzRXTCr1V3ND6pZRYUYX72cR4OaRoSDGSAFCeaeToFQKyz2u ZOVCS3EeoFRbg7hZBQruyjUXfnVakyZOOkp+3hjQ9KpxbSuLbl3HEWjPRWDHbRq+3Kkm HEbNIS6LgKcYWgk2alrV8ZI5KE2pEdYS1czxajVWmxr8uqPE4Sl8uwZ+GDIblzqUAt4v /aF0sf5e+tbtVwHuypgpKcldyZFlnKf698bHxuKk4u2Tf1ZimSuDDolR3b9OXLrnjN3I v21Q== 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:openpgp:from:references:cc:to:subject:reply-to :dkim-signature; bh=RrTsE0wgt4rHxxQBsqXuvRbPprnBOY7nLRDiC5b6+VI=; b=xHTgfWC/y38K7MNFX8rpB8LzQqwJNW42mLcFZYxPcQV5WqX+N4zRwd3X0+86aA/lCg ftoYSBp+VBRsZNdzaSkmW2tAVhlY2Ut9GF51pwo6SNhyLqSklfh4yTniW8cKV7uWZTyC Kb3L/JaEzehNA0fJ/2TXlDjCtLJPUnhPVvGwrdUdfjjTOy1vlSEuumwUujeRvBr3graS vT5UF1Pi8LcLO6sYrW9unEtjcgPU6IB4JDcwf0LM0Z7oD7nYgUUYHnEzCOJt8SY6TfRl ldHWZKMolQnIv3oAsP8WnslhybT336pQBqLC0FdxRyTgr9G0jy6Lm4q8uG8yYqZVoSSQ 1UXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=x0CZ4Uzb; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i69si19556113plb.75.2019.03.27.03.38.35; Wed, 27 Mar 2019 03:38:50 -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; dkim=pass header.i=@kernel.org header.s=default header.b=x0CZ4Uzb; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733050AbfC0Khv (ORCPT + 99 others); Wed, 27 Mar 2019 06:37:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:56178 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727557AbfC0Khv (ORCPT ); Wed, 27 Mar 2019 06:37:51 -0400 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 8CA742075E; Wed, 27 Mar 2019 10:37:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553683069; bh=ezjpCDCkTHOuKNYwC6P7BLhLee/p6Im3y26aES/lc3s=; h=Reply-To:Subject:To:Cc:References:From:Date:In-Reply-To:From; b=x0CZ4Uzb8eEsrkx3JK1SUqMJBn1IWFrevf7muOF1pahQ835fOrCZrJ8vJJAkD9gne +KzsmDM/AY0i83Fq8jzoWFq0zXGIrwDGxthdwjTybs6GmFe5VpRK8gL4DsfaD/FGHM VbY/0zdcMpY/8LOHKsz8r9H+uP4SYzejL8oSfJF0= Reply-To: kbingham@kernel.org Subject: Re: [PATCH 3/4] scripts/gdb: Add rb tree iterating utilities To: Stephen Boyd , Andrew Morton Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Douglas Anderson , Nikolay Borisov , Jan Kiszka , Jackie Liu References: <20190325184522.260535-1-swboyd@chromium.org> <20190325184522.260535-4-swboyd@chromium.org> <227f1a1f-d8dd-72f4-4eb9-43bba714d52a@kernel.org> <155361993610.20095.762425616683725063@swboyd.mtv.corp.google.com> From: Kieran Bingham Openpgp: preference=signencrypt Message-ID: <88d66467-1d0d-da23-3cee-f09e680d8078@kernel.org> Date: Wed, 27 Mar 2019 10:37:44 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <155361993610.20095.762425616683725063@swboyd.mtv.corp.google.com> 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 Hi Stephen, On 26/03/2019 17:05, Stephen Boyd wrote: > Quoting Kieran Bingham (2019-03-26 01:52:10) >> Hi Stephen, >> >> On 25/03/2019 18:45, Stephen Boyd wrote: >>> Implement gdb functions for rb_first(), rb_last(), rb_next(), and >>> rb_prev(). These can be useful to iterate through the kernel's red-black >>> trees. >> >> I definitely approve of getting data-structure helpers into scripts/gdb, >> as it will greatly assist debug options but my last attempt to do this >> was with the radix-tree which I had to give up on as the internals were >> changing rapidly and caused continuous breakage to the helpers. > > Thanks for the background on radix-tree. I haven't looked at that yet, > but I suppose I'll want to have that too at some point. Sure, it will be useful to get going again, if you get round to it - feel free to either dig out my old patches from the list, or git-history. (I believe they actually made it into the kernel but I had to revert them because of the breakage, and no time to continue that development). Or of course - start from scratch might also be a good option :D >> Do you foresee any similar issue here? Or is the corresponding RB code >> in the kernel fairly 'stable'? >> >> >> Please could we make sure whomever maintains the RBTree code is aware of >> the python implementation? >> >> That said, MAINTAINERS doesn't actually seem to list any ownership over >> the rb-tree code, and get_maintainers.pl [0] seems to be pointing at >> Andrew as the probable route in for that code so perhaps that's already >> in place :D > > I don't think that the rb tree implementation is going to change. It > feels similar to the list API. I suppose this problem of keeping things > in sync is a more general problem than just data-structures changing. > The only solution I can offer is to have more testing and usage of these > scripts. Unless gdb can "simulate" or run arbitrary code for us then I > think we're stuck reimplementing kernel internal code in gdb scripts so > that we can get debug info out. I agree - RB seems a lot more stable than the radix-tree was back when I tried to mirror that implementation. I would hope at some point we could get some automated tests going for scripts/gdb as we see more and more functionality. Everything should be automatable using GDB hooked up to QEmu. GDB can 'run' arbitrary functions - but it's not a good idea as we won't know the state of the target, and of course in the case of crash-dump examination - the target won't even exist. Anyway, I'm glad this is all useful to you - let us know if there's anything we can do to help. Myself and Jan are trying to take care of scripts/gdb - but there's not a lot of active development of new features currently - so I'm very pleased to see your contributions ! -- Kieran