Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1696784
| Path | csiph.com!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Pratyush Anand <panand@redhat.com> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH V2 4/4] arm64: disable irq between breakpoint and step exception |
| Date | Wed, 26 Jul 2017 07:40:01 +0200 |
| Message-ID | <u7nd7-4CC-1@gated-at.bofh.it> (permalink) |
| References | <u0Af7-3Q5-5@gated-at.bofh.it> <u0Af8-3Q5-37@gated-at.bofh.it> <u784q-3jY-7@gated-at.bofh.it> |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=+o0lTrIBZ6D0RMZB2YdUi2NufxkneCOw4JWgdPahLis=; b=YdAQqjDEWAhrShTiLQNIVug4bTtTYXR8r4kHXuOZ9ZQ2rCxaaBoaEJAxM0V2Uq19QI w1CP0+aB0X6+c/ccgXghSzChZBp5prJVBSGfqjyFLc/xnUiygqVH1+zhKE81iFotylhr BfDYIqMkekOXlv6BjuKlqj0okbGhNNJ7PxTmmtd38oqWmuMvDvrMBU6RGn1gw+bIswp4 blBLYy/W6KJqg9sKl53fZ72QOCxKXIxB//FiRStgE3cbRE5Luj7kK9dh/bKSqif4Bnz8 NtR6A1sGgm7Bb+/zyEckqQUdqONnjyFI/RFrW1p3uJSlF417fDPc4zjgiArjxM454CXR 9N4g== |
| X-Gm-Message-State | AIVw113JX7R6b+j+oxk6YBIj3tZGOS2YYDXrB3scuV5kPs7MoxoysprD eD6QA4zmUOx+C2zESINZLA== |
| X-Received | by 10.98.78.73 with SMTP id c70mr21395944pfb.17.1501047366335; Tue, 25 Jul 2017 22:36:06 -0700 (PDT) |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Language | en-US |
| Content-Transfer-Encoding | 7bit |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 60 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | mark.rutland@arm.com, huawei.libin@huawei.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org |
| X-Original-Date | Wed, 26 Jul 2017 11:06:02 +0530 |
| X-Original-Message-ID | <db8f4516-f16a-adb7-bbca-d38e1acad02b@redhat.com> |
| X-Original-References | <cover.1499416107.git.panand@redhat.com> <8f9c3073792c107e3d928e413499572ec75c5175.1499416107.git.panand@redhat.com> <20170725132551.GB28815@arm.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1696784 |
Show key headers only | View raw
Hi Will, Thanks for your review. On Tuesday 25 July 2017 06:55 PM, Will Deacon wrote: > On Fri, Jul 07, 2017 at 05:34:00PM +0530, Pratyush Anand wrote: >> If an interrupt is generated between breakpoint and step handler then >> step handler can not get correct step address. This situation can easily >> be invoked by samples/hw_breakpoint/data_breakpoint.c. It can also be >> reproduced if we insert any printk() statement or dump_stack() in perf >> overflow_handler. So, it seems that perf is working fine just luckily. >> If the CPU which is handling perf breakpoint handler receives any >> interrupt then, perf step handler will not execute sanely. >> >> This patch improves do_debug_exception() handling, which enforces now, >> that exception handler function: >> - should return 0 for any software breakpoint and hw >> breakpoint/watchpoint handler if it does not expect a single step stage >> - should return 1 if it expects single step. >> - A single step handler should always return 0. >> - All handler should return a -ve error in any other case. >> >> Now, we can know in do_debug_exception() that whether a step exception >> will be followed or not. If there will a step exception then disable >> irq. Re-enable it after single step handling. > > AFAICT, this is only a problem for kernel-mode breakpoints where we end up > stepping into the interrupt handler when trying to step over a breakpoint. I think yes. > > We'd probably be better off getting all users of kernel step (kprobes, kgdb > and perf) to run the step with irqs disabled, That should be doable. We can easily manage all of them in do_debug_exception() if individual brk handlers return correct value as per the rule mentioned in the commit log of this patch. I think, I can take care of kprobes and kgdb as well in next version of patch. > but I still have reservations > about that: So, IIUC, you have concern about faulting of a instruction being stepped. Since we will have a notion of *irq_en_needed*, so I think, if needed we can re-enable interrupt in fault handler do_mem_abort(). Whats your opinion here? > > http://lists.infradead.org/pipermail/linux-arm-kernel/2017-May/508066.html > http://lists.infradead.org/pipermail/linux-arm-kernel/2017-June/510814.html > > Wouldn't it be better to follow kprobes/kgdb and have perf run the step with > irqs disabled? -- Regards Pratyush
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: [PATCH V2 4/4] arm64: disable irq between breakpoint and step exception Will Deacon <will.deacon@arm.com> - 2017-07-25 15:30 +0200 Re: [PATCH V2 4/4] arm64: disable irq between breakpoint and step exception Pratyush Anand <panand@redhat.com> - 2017-07-26 07:40 +0200
csiph-web