From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 89959 invoked by alias); 19 Jun 2017 13:20:37 -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 89487 invoked by uid 89); 19 Jun 2017 13:20:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*RU:209.85.220.194, Hx-spam-relays-external:209.85.220.194, H*r:sk:static. X-HELO: mail-qk0-f194.google.com Received: from mail-qk0-f194.google.com (HELO mail-qk0-f194.google.com) (209.85.220.194) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 19 Jun 2017 13:20:34 +0000 Received: by mail-qk0-f194.google.com with SMTP id r62so6753596qkf.3 for ; Mon, 19 Jun 2017 06:20:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=Z/42uJe+m3CmI0LF1Bl16YHVqQb6bKoCkMgkLZryl3E=; b=RyzSn8r/DHbMFkC+M6BfVzpXgOhFQUUPmtAAYMDwnEp/j1Utbm+lCeDsjMqZY5jE15 mo6UFdZV5vJyxH9KqVUpU0QlgogBRhnpaJu69d9wRrnZFxKIg3xoMjP797rTXxq+wZdW zRovZsTN9Kzw07TpNqS65LDOmeD6DpYx/sf8TrhApe1sEkrd4cD9luw+SwcZs8Q3jP8N /PkxK71xGGt+d6zPnnfWXkehSYpQKLvR2kIdd+nbHCjklvY1/YzdDVcCtI3MTF/RxuRq 5cURqyeJaunP5CWdwlvsz5FxhndHDBiDX8VOa6FRXdSTCkjEFOLohCmumtL77WvhgYwW Sz/A== X-Gm-Message-State: AKS2vOz1fu+BQDUJfEAhR0Qu0pxzmAdvGF+wQkaDuyLCFeUQ1gQS55ZQ yUXW00mR/wVRbg== X-Received: by 10.55.54.196 with SMTP id d187mr29149467qka.96.1497878438102; Mon, 19 Jun 2017 06:20:38 -0700 (PDT) Received: from E107787-LIN (static.42.136.251.148.clients.your-server.de. [148.251.136.42]) by smtp.gmail.com with ESMTPSA id 79sm6958693qky.50.2017.06.19.06.20.36 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 19 Jun 2017 06:20:37 -0700 (PDT) From: Yao Qi To: Philipp Rudo Cc: gdb-patches@sourceware.org, omair.javaid@linaro.org, yao.qi@linaro.org, peter.griffin@linaro.org, arnez@linux.vnet.ibm.com Subject: Re: [RFC v4 9/9] Add S390 support for linux-kernel target References: <20170612170836.25174-1-prudo@linux.vnet.ibm.com> <20170612193900.234bc540@ThinkPad> Date: Mon, 19 Jun 2017 13:20:00 -0000 In-Reply-To: <20170612193900.234bc540@ThinkPad> (Philipp Rudo's message of "Mon, 12 Jun 2017 19:39:00 +0200") Message-ID: <86poe0nmfx.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2017-06/txt/msg00509.txt.bz2 Philipp Rudo writes: > +/* S390s kernel stack is split up on several memory locations: > + > + - kernel stack (per task) > + - async aka. interrupt stack (per cpu) > + - panic stack (per cpu) > + - restart stack (unique, global) > + > + Each memory location is page aligned and has a size of four consecuti= ve > + pages (except the panic stack with only one page). */ > + > +enum s390_lk_stack_location > +{ > + S390_LK_STACK_INVALID =3D -1, > + S390_LK_STACK_USER, > + S390_LK_STACK_KERNEL, > + S390_LK_STACK_ASYNC, > + S390_LK_STACK_PANIC, > + S390_LK_STACK_RESTART > +}; > + Did you consider adding different frame unwinders for frames on different memory locations? Your patches only adds two, but IMO, we need more unwinders for different frames, > + > +/* Helper macro for s390_lk_get_stack_location to check for stacks which > + locations are stored in the lowcore. > + > + _addr address to be checked for > + _lc address of the corresponding lowcore > + _stack field name of stack in lowcore > + _type type to be returned if _addr is on _stack > + _size size of _stack > +*/ > + > +#define s390_lk_check_lowcore_stack(_addr, _lc, _stack, _type, _size) \ > + do \ > + { \ > + CORE_ADDR _##_stack, _##_stack##_top, _##_stack##_bottom; \ > + _##_stack =3D lk_read_addr ((_lc) + LK_OFFSET (lowcore, _stack)); \ > + _##_stack##_top =3D S390_LK_ROUNDUP (_##_stack, S390_LK_PAGESIZE);= \ > + _##_stack##_bottom =3D _##_stack##_top - (_size); \ > + if ((_addr) <=3D _##_stack##_top && (_addr) >=3D _##_stack##_botto= m) \ > + return (_type); \ > + } \ > + while (0) > + > +/* Find and return the stack location of ADDR belonging to TASK. */ > + > +static enum s390_lk_stack_location > +s390_lk_get_stack_location (CORE_ADDR task, CORE_ADDR addr) > +{ > + CORE_ADDR lowcore, top, bottom; > + unsigned int cpu =3D lk_task_running (task); > + > + > + /* Kernel stack. */ > + bottom =3D lk_read_addr (task + LK_OFFSET (task_struct, stack)); > + top =3D bottom + S390_LK_STACKSIZE; > + if (addr <=3D top && addr >=3D bottom) > + return S390_LK_STACK_KERNEL; > + > + /* A sleeping task only has the kernel stack. If a sleeping task reac= hes > + this point ADDR isn't on the stack. */ > + if (cpu =3D=3D LK_CPU_INVAL) > + return S390_LK_STACK_INVALID; > + > + lowcore =3D s390_lk_get_lowcore (cpu); > + > + /* Async aka. interrupt stack. */ > + s390_lk_check_lowcore_stack (addr, lowcore, async_stack, > + S390_LK_STACK_ASYNC, S390_LK_ASYNCSIZE); > + > + /* Panic stack. > + Note: The panic stack only has a size of one page. */ > + s390_lk_check_lowcore_stack (addr, lowcore, panic_stack, > + S390_LK_STACK_PANIC, S390_LK_PAGESIZE); > + > + /* Restart stack. */ > + s390_lk_check_lowcore_stack (addr, lowcore, restart_stack, > + S390_LK_STACK_RESTART, S390_LK_ASYNCSIZE); > + > + return S390_LK_STACK_INVALID; > +} The unwinders for different frames should be chained in this order. --=20 Yao (=E9=BD=90=E5=B0=A7)