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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21AC3C433F5 for ; Tue, 15 Mar 2022 12:55:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6CF6B8D0002; Tue, 15 Mar 2022 08:55:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 67E928D0001; Tue, 15 Mar 2022 08:55:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5463C8D0002; Tue, 15 Mar 2022 08:55:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 467318D0001 for ; Tue, 15 Mar 2022 08:55:43 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 00FD6120EFB for ; Tue, 15 Mar 2022 12:55:42 +0000 (UTC) X-FDA: 79246617366.06.8328B14 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf16.hostedemail.com (Postfix) with ESMTP id 53EFB180012 for ; Tue, 15 Mar 2022 12:55:42 +0000 (UTC) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1647348939; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=NYXfNXw6anC7/Ia9gZ/gcwUtpq8IOl+ZWa7iKXWae9A=; b=m0QCsIOFAiom1MJFjO/3AhXm2OM/JSrhq8P7VuzJrUZKCAWpshOd8vginvsYKBmIXBjuf4 +GqSx91+D+eFVIme0FqV0JERSziSFhpAk7P2WmENpiElrJ4pDENIxOSda90j2PWXqtYuo6 ZlhXbiWefD9Td/DLfc7PKnglDEIMVWgQP2BovmYDT3D32Mt7zGP88jJUFwm8pQmvTSxoIi qnyko8ICM5KGCrmiMsf75t2L0XkapittDABnOnDfSSCt6P3XppGhq8DBINoeLKSkYKDznf oMGEp+nTSxcIy8hTdIlzQH0AzW0tdWFyvhLvtSkqPN2TdGEOtO0vme+v6dYAvA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1647348939; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=NYXfNXw6anC7/Ia9gZ/gcwUtpq8IOl+ZWa7iKXWae9A=; b=FpjAtu3irEqm8WgQ/R+orm9ovGipxUOyf8nkKSVcx+31spRhN6oJjkZMdn9mtg1W9N0xva 8Mq6QMX1fjZYTXBQ== To: Junaid Shahid , linux-kernel@vger.kernel.org Cc: kvm@vger.kernel.org, pbonzini@redhat.com, jmattson@google.com, pjt@google.com, oweisse@google.com, alexandre.chartre@oracle.com, rppt@linux.ibm.com, dave.hansen@linux.intel.com, peterz@infradead.org, luto@kernel.org, linux-mm@kvack.org Subject: Re: [RFC PATCH 04/47] mm: asi: ASI support in interrupts/exceptions In-Reply-To: <9f2f1226-f398-f132-06f4-c21a2a2d1033@google.com> References: <20220223052223.1202152-1-junaids@google.com> <20220223052223.1202152-5-junaids@google.com> <87pmmofs83.ffs@tglx> <9f2f1226-f398-f132-06f4-c21a2a2d1033@google.com> Date: Tue, 15 Mar 2022 13:55:39 +0100 Message-ID: <877d8v74tw.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Rspam-User: Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=m0QCsIOF; dkim=pass header.d=linutronix.de header.s=2020e header.b=FpjAtu3i; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf16.hostedemail.com: domain of tglx@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=tglx@linutronix.de X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 53EFB180012 X-Stat-Signature: urjjqpjbu5783sp6xuqcqq88uctsu4ix X-HE-Tag: 1647348942-764834 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Junaid, On Mon, Mar 14 2022 at 19:01, Junaid Shahid wrote: > On 3/14/22 08:50, Thomas Gleixner wrote: >> On Tue, Feb 22 2022 at 21:21, Junaid Shahid wrote: >>> #define DEFINE_IDTENTRY_RAW(func) \ >>> -__visible noinstr void func(struct pt_regs *regs) >>> +static __always_inline void __##func(struct pt_regs *regs); \ >>> + \ >>> +__visible noinstr void func(struct pt_regs *regs) \ >>> +{ \ >>> + asi_intr_enter(); \ >> >> This is wrong. You cannot invoke arbitrary code within a noinstr >> section. >> >> Please enable CONFIG_VMLINUX_VALIDATION and watch the build result with >> and without your patches. >> > Thank you for the pointer. It seems that marking asi_intr_enter/exit > and asi_enter/exit, and the few functions that they in turn call, as > noinstr would fix this, correct? (Along with removing the VM_BUG_ONs > from those functions and using notrace/nodebug variants of a couple of > functions). you can keep the BUG_ON()s. If such a bug happens the noinstr correctness is the least of your worries, but it's important to get the information out, right? Vs. adding noinstr. Yes, making the full callchain noinstr is going to cure it, but you really want to think hard whether these calls need to be in this section of the exception handlers. These code sections have other constraints aside of being excluded from instrumentation, the main one being that you cannot use RCU there. I'm not yet convinced that asi_intr_enter()/exit() need to be invoked in exactly the places you put it. The changelog does not give any clue about the why... Thanks, tglx