From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A30E9C77B60 for ; Wed, 26 Apr 2023 04:35:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:References:Content-Type: In-Reply-To:MIME-Version:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cnFbnc92GQIoEv1QnK6BF3NhtTrwXHwaEBNynqoNuuQ=; b=stcIgabyU04LCff7dmchqifjNa EsDv9vgOQRZvRMrzneUKsBgSVfCGZaz81DJwSFC5yYLRBanVu4o7q6a5eT21LBTVx7G3vh+UUlGHD Eki42P1AXF8IBw8t7cOxjhVYYpILg2TtgBnF0yuoE7U2ugnJk2RsW2sOIzzudgT3s3UQ6djl1WFLa ISWgY0jnmPVQAcVJG2kbiDxX1Ntif5o93nXa6rGGTF1LLKIcelbIIiLFXtPHfJDkFKGu33Vuvi9ht QzfLQJ8/F62rFYvEiQxMVLskHgUzDbWhU/lSGUhhQ9Gjbe+mE5tqJYi2Vw2InztV9/ExNT+UJhAi0 V8Zhsn4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1prWrY-002m10-0v; Wed, 26 Apr 2023 04:34:40 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1prWrU-002m0G-03 for linux-arm-kernel@lists.infradead.org; Wed, 26 Apr 2023 04:34:38 +0000 Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20230426043428epoutp046c293cfcbee22c08417a765d3c9133cb~ZYftuaUHD2506125061epoutp046 for ; Wed, 26 Apr 2023 04:34:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20230426043428epoutp046c293cfcbee22c08417a765d3c9133cb~ZYftuaUHD2506125061epoutp046 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1682483668; bh=Uc3iZzzNNfvg7uppIGUgZCX7utPBuOk0LcUwE4Bt/og=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=slCRiE35XigO8eb2q+WCUUPAOfR1JpUrBs6ok/nJeSGEKph/Y/bQgqa+012RrKWov nuLgDsCBReg2IsMLsWUpHBOJSzia1aem1LW5DO9L2tGci9yWYmGVql2gVkUQF1m3cx 6ioovBe3xBGcGgJL9K6X2HzRo7IjiiLl22ngd0go= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20230426043427epcas2p1e434fe8627622612fa468b484c54edfb~ZYftMUKz82074420744epcas2p1q; Wed, 26 Apr 2023 04:34:27 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.36.101]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4Q5mH71G0Vz4x9QC; Wed, 26 Apr 2023 04:34:27 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 7A.E3.22936.3D9A8446; Wed, 26 Apr 2023 13:34:27 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p1.samsung.com (KnoxPortal) with ESMTPA id 20230426043426epcas2p1aed491a1b7ecf266ac110858aaca4e65~ZYfsQjp5_2337823378epcas2p1I; Wed, 26 Apr 2023 04:34:26 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230426043426epsmtrp12fa17229fa2862520ea0608791101322~ZYfsPq1Gr2119821198epsmtrp1x; Wed, 26 Apr 2023 04:34:26 +0000 (GMT) X-AuditID: b6c32a48-475ff70000005998-c2-6448a9d33094 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 15.E4.27706.2D9A8446; Wed, 26 Apr 2023 13:34:26 +0900 (KST) Received: from perf (unknown [10.229.95.91]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230426043426epsmtip2ddd0be85797fb5fec6f67d51aa2818cd~ZYfr7aynj2923729237epsmtip2W; Wed, 26 Apr 2023 04:34:26 +0000 (GMT) Date: Wed, 26 Apr 2023 14:06:25 +0900 From: Youngmin Nam To: Mark Rutland Cc: catalin.marinas@arm.com, will@kernel.org, anshuman.khandual@arm.com, broonie@kernel.org, alexandru.elisei@arm.com, ardb@kernel.org, linux-arm-kernel@lists.infradead.org, hy50.seo@samsung.com, andreyknvl@gmail.com, maz@kernel.org, kasan-dev , Dmitry Vyukov , d7271.choe@samsung.com Subject: Re: [PATCH] arm64: set __exception_irq_entry with __irq_entry as a default Message-ID: MIME-Version: 1.0 In-Reply-To: X-Brightmail-Tracker: H4sIAAAAAAAAA02Sf0xTVxTHc98r7z3cSp7V4U3dj6bNUHHQFlv6QNAlMPcy9weBacKyBV/b l5ZQ2q6vNdZlyhalhTJHE9HQgTJh8jOTQFNLETBg+BEW/BncjDhYnRmQQeeYZGzTtby6+N/n nPv9nnvOvYdARX5MTJSa7azNzJik2AZBYGQHlXa7ndYrlk5i1Nn22xi16j2LU4PjOuqvlWVA 1c09xKjlizWAmh7w4lTtXCVOdTbPCqi2Rz8hVE94OoH69u5NhO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AAA+NgFvrDLMWRmVeSWpSXmKPExsWy7bCSvO6llR4pBofuKVlMX3mZzeL7xOns FvtOJFv8/PKe0WLqwydsFu+X9TBaXNs7kd1iwsM2dovVix+wWKx4dp/JYtPja6wWS69fZLLY Oeckq0XLHVMHPo8189YweuycdZfdY8GmUo89E0+yeWxa1cnmsXlJvUffllWMAexRXDYpqTmZ ZalF+nYJXBlL97xmK1hsXrFr/nHmBsYLul2MnBwSAiYSFzpusnQxcnEICexmlHjV9IENIiEj cXvlZVYIW1jifssRVoii+4wS9zb9A0uwCKhKfFmxHsxmE9CV2HbiHyOILSKgLtGz6wvYVGaB a0wSvS2z2LsYOTiEBUIlVr+SAKnhFVCWOL38HDvE0NdMEpefvGOFSAhKnJz5hAXEZhbQkrjx 7yUTSC+zgLTE8n8cIGFOATuJEw/2M09gFJiFpGMWko5ZCB0LGJlXMUqmFhTnpucWGxYY5qWW 6xUn5haX5qXrJefnbmIER5CW5g7G7as+6B1iZOJgPMQowcGsJMLLW+meIsSbklhZlVqUH19U mpNafIhRmoNFSZz3QtfJeCGB9MSS1OzU1ILUIpgsEwenVAPTxnULqiZEHVl/I8qspezqp4AO 9abV/7YkH9W9whZypSp/6dMJYUYOE/g4Sox2LG+rmKvEvlcr/NnxZubmN1sizZk/zAzW0mT4 cJK1oursIf3VC5SllNgvCHgfYbn6/Zvo7sWT7GeWq/CEcTncOF8v0brY+iDXlccMVs7z7n/a JblD/JfG3/++7xxaM4snr2Fe/v3tCoULDwtebuN9Mn2xb9Xnp36TH1kK3F2Qndt+RefN7rS9 tfc+KUoe3m5ypbKDa/rimogTld8uu55SXH7wsxpL5f+GWMsLNYUTmE975MYxXdYv+nyMc8+B oGfP1ppGZYcmRN4598NTWCP0RdLkpsQ8xmmrt3+qn/+L53TtWSWW4oxEQy3mouJEANnB8QMP AwAA X-CMS-MailID: 20230426043426epcas2p1aed491a1b7ecf266ac110858aaca4e65 X-Msg-Generator: CA Content-Type: multipart/mixed; boundary="----..lw3wo6cvlWZB4q78b.qMrUTx.UecKfd4NgAaoOFLJBmQ0t=_8920b_" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230424003252epcas2p29758e056b4766e53c252b5927a0cb406 References: <20230424010436.779733-1-youngmin.nam@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230425_213436_747075_BE7217BE X-CRM114-Status: GOOD ( 42.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org ------..lw3wo6cvlWZB4q78b.qMrUTx.UecKfd4NgAaoOFLJBmQ0t=_8920b_ Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline On Tue, Apr 25, 2023 at 02:39:51PM +0100, Mark Rutland wrote: > On Tue, Apr 25, 2023 at 11:31:31AM +0900, Youngmin Nam wrote: > > On Mon, Apr 24, 2023 at 02:08:14PM +0100, Mark Rutland wrote: > > > On Mon, Apr 24, 2023 at 02:09:05PM +0200, Dmitry Vyukov wrote: > > > > On Mon, 24 Apr 2023 at 13:01, Mark Rutland wrote: > > > > > > > > > > On Mon, Apr 24, 2023 at 10:04:36AM +0900, Youngmin Nam wrote: > > > > > > filter_irq_stacks() is supposed to cut entries which are related irq entries > > > > > > from its call stack. > > > > > > And in_irqentry_text() which is called by filter_irq_stacks() > > > > > > uses __irqentry_text_start/end symbol to find irq entries in callstack. > > > > > > > > > > > > But it doesn't work correctly as without "CONFIG_FUNCTION_GRAPH_TRACER", > > > > > > arm64 kernel doesn't include gic_handle_irq which is entry point of arm64 irq > > > > > > between __irqentry_text_start and __irqentry_text_end as we discussed in below link. > > > > > > > > > > TBH, the __irqentry_text annotations don't make much sense, and I'd love to > > > > > remove them. > > > > > > > > > > The irqchip handlers are not the actual exception entry points, and we invoke a > > > > > fair amount of code between those and the actual IRQ handlers (e.g. to map from > > > > > the irq domain to the actual hander, which might involve poking chained irqchip > > > > > handlers), so it doesn't make much sense for the irqchip handlers to be > > > > > special. > > > > > > > > > > > https://lore.kernel.org/all/CACT4Y+aReMGLYua2rCLHgFpS9io5cZC04Q8GLs-uNmrn1ezxYQ@mail.gmail.com/#t > > > > > > > > > > > > This problem can makes unintentional deep call stack entries especially > > > > > > in KASAN enabled situation as below. > > > > > > > > > > What exactly does KASAN need here? Is this just to limit the depth of the > > > > > trace? > > > > > > > > No, it's not just depth. Any uses of stack depot need stable > > > > repeatable traces, so that they are deduplicated well. For irq stacks > > > > it means removing the random part where the interrupt is delivered. > > > > Otherwise stack depot grows without limits and overflows. > > > > Hi Dmitry Vyukov. > > Thanks for your additional comments. > > > > > > > > Sure -- you want to filter out the non-deterministic context that the interrupt > > > was taken *from*. > > > > > > > We don't need the exact entry point for this. A frame "close enough" > > > > may work well if there are no memory allocations/frees skipped. > > > > > > With that in mind, I think what we should do is cut this at the instant we > > > enter the exception; for the trace below that would be el1h_64_irq. I've added > > > some line spacing there to make it stand out. > > > > > > That would mean that we'd have three entry points that an interrupt trace might > > > start from: > > > > > > * el1h_64_irq() > > > * el0t_64_irq() > > > * el0t_32_irq() > > > > > > > Hi Mark. > > Thanks for your kind review. > > > > If I understand your intention corretly, I should add "__irq_entry" > > to C function of irq_handler as below. > > I'd meant something like the below, marking the assembly (as x86 does) rather > than the C code. I'll try to sort that out and send a proper patch series after > -rc1. > > Thanks, > Mark. > After applying your draft patch, I checked System.map and could see irq entries we expected were included as below. ffffffc008000000 T _text ffffffc008010000 T __irqentry_text_start ffffffc008010000 T _stext ffffffc008010000 t el1t_64_irq ffffffc00801006c t el1t_64_fiq ffffffc0080100d8 t el1h_64_irq ffffffc008010144 t el1h_64_fiq ffffffc0080101b0 t el0t_64_irq ffffffc008010344 t el0t_64_fiq ffffffc0080104d8 t el0t_32_irq ffffffc008010670 t el0t_32_fiq ffffffc008010928 T __do_softirq ffffffc008010928 T __irqentry_text_end ffffffc008010928 T __softirqentry_text_start ffffffc008010fa0 T __entry_text_start ffffffc008010fa0 T __softirqentry_text_end And then, I confirmed callstack was cut correctly as below. [ 89.738326]I[5:NetworkWatchlis: 1084] kasan_save_stack+0x40/0x70 [ 89.738337]I[5:NetworkWatchlis: 1084] save_stack_info+0x34/0x138 [ 89.738348]I[5:NetworkWatchlis: 1084] kasan_save_free_info+0x18/0x24 [ 89.738358]I[5:NetworkWatchlis: 1084] ____kasan_slab_free+0x16c/0x170 [ 89.738369]I[5:NetworkWatchlis: 1084] __kasan_slab_free+0x10/0x20 [ 89.738379]I[5:NetworkWatchlis: 1084] kmem_cache_free+0x238/0x53c [ 89.738388]I[5:NetworkWatchlis: 1084] mempool_free_slab+0x1c/0x28 [ 89.738397]I[5:NetworkWatchlis: 1084] mempool_free+0x7c/0x1a0 [ 89.738405]I[5:NetworkWatchlis: 1084] bvec_free+0x34/0x80 [ 89.738417]I[5:NetworkWatchlis: 1084] bio_free+0x60/0x98 [ 89.738426]I[5:NetworkWatchlis: 1084] bio_put+0x50/0x21c [ 89.738434]I[5:NetworkWatchlis: 1084] f2fs_write_end_io+0x4ac/0x4d0 [ 89.738444]I[5:NetworkWatchlis: 1084] bio_endio+0x2dc/0x300 [ 89.738453]I[5:NetworkWatchlis: 1084] __dm_io_complete+0x324/0x37c [ 89.738464]I[5:NetworkWatchlis: 1084] dm_io_dec_pending+0x60/0xa4 [ 89.738474]I[5:NetworkWatchlis: 1084] clone_endio+0xf8/0x2f0 [ 89.738484]I[5:NetworkWatchlis: 1084] bio_endio+0x2dc/0x300 [ 89.738493]I[5:NetworkWatchlis: 1084] blk_update_request+0x258/0x63c [ 89.738503]I[5:NetworkWatchlis: 1084] scsi_end_request+0x50/0x304 [ 89.738514]I[5:NetworkWatchlis: 1084] scsi_io_completion+0x88/0x160 [ 89.738524]I[5:NetworkWatchlis: 1084] scsi_finish_command+0x17c/0x194 [ 89.738534]I[5:NetworkWatchlis: 1084] scsi_complete+0xcc/0x158 [ 89.738543]I[5:NetworkWatchlis: 1084] blk_mq_complete_request+0x4c/0x5c [ 89.738553]I[5:NetworkWatchlis: 1084] scsi_done_internal+0xf4/0x1e0 [ 89.738564]I[5:NetworkWatchlis: 1084] scsi_done+0x14/0x20 [ 89.738575]I[5:NetworkWatchlis: 1084] ufshcd_compl_one_cqe+0x578/0x71c [ 89.738585]I[5:NetworkWatchlis: 1084] ufshcd_mcq_poll_cqe_nolock+0xc8/0x150 [ 89.738594]I[5:NetworkWatchlis: 1084] exynos_vendor_mcq_irq+0xac/0xc4 [ufs_exynos_core] [ 89.738638]I[5:NetworkWatchlis: 1084] __handle_irq_event_percpu+0xd0/0x348 [ 89.738647]I[5:NetworkWatchlis: 1084] handle_irq_event_percpu+0x24/0x74 [ 89.738656]I[5:NetworkWatchlis: 1084] handle_irq_event+0x74/0xe0 [ 89.738665]I[5:NetworkWatchlis: 1084] handle_fasteoi_irq+0x174/0x240 [ 89.738675]I[5:NetworkWatchlis: 1084] handle_irq_desc+0x6c/0x2c0 [ 89.738686]I[5:NetworkWatchlis: 1084] generic_handle_domain_irq+0x1c/0x28 [ 89.738697]I[5:NetworkWatchlis: 1084] gic_handle_irq+0x64/0x154 [ 89.738707]I[5:NetworkWatchlis: 1084] call_on_irq_stack+0x2c/0x54 [ 89.738717]I[5:NetworkWatchlis: 1084] do_interrupt_handler+0x70/0xa0 [ 89.738726]I[5:NetworkWatchlis: 1084] el1_interrupt+0x34/0x68 [ 89.738737]I[5:NetworkWatchlis: 1084] el1h_64_irq_handler+0x18/0x24 [ 89.738747]I[5:NetworkWatchlis: 1084] el1h_64_irq+0x68/0x6c Thanks for your work. Please add me when you send the final patch so that I can test again. > ---->8---- ------..lw3wo6cvlWZB4q78b.qMrUTx.UecKfd4NgAaoOFLJBmQ0t=_8920b_ Content-Type: text/plain; charset="utf-8" ------..lw3wo6cvlWZB4q78b.qMrUTx.UecKfd4NgAaoOFLJBmQ0t=_8920b_ Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ------..lw3wo6cvlWZB4q78b.qMrUTx.UecKfd4NgAaoOFLJBmQ0t=_8920b_--