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 3A5EEC433EF for ; Fri, 1 Jul 2022 10:04:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A09A96B0071; Fri, 1 Jul 2022 06:04:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 993836B0073; Fri, 1 Jul 2022 06:04:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 832F26B0074; Fri, 1 Jul 2022 06:04:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 7156D6B0071 for ; Fri, 1 Jul 2022 06:04:45 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 47DEB34A26 for ; Fri, 1 Jul 2022 10:04:45 +0000 (UTC) X-FDA: 79638096930.27.29B99CA Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) by imf13.hostedemail.com (Postfix) with ESMTP id E04342004A for ; Fri, 1 Jul 2022 10:04:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1656669884; x=1688205884; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=C9yKLAcuZ5hnkYBCpoRQx1zMhVYu01vnHM+Lplb5HMc=; b=BxifDh2c1kPEu3rm1uWBi2bGi5bTCS9kg/uE4xzOjT92oHFOlMDR1D/Z IWBmJCDtu6BncqQHiRcTH+F8ziELcFgldto5cd8o6IQye5mVHg4fA91e5 spohbFvaQ+RfKqnXuN7+uc9/59MhEJVPfIj1eNlPNLPGN1+9k9ewdiOdV rcaSrJlkY/rZhNA6l6Jb3XHDJ5dP9pghrwdEqrmJxo73+C5+qJYUNw94Z RxHjBc+PdtgbzVUxV49SU/jLqd5BYmz5VFh5EjN783/Rx8xkOsXt5mOj8 WfR106TfTFYzuLfgpAhNzVk8+UpaQ9NaMANVPUBoWHZ701FR4igDc+DeN Q==; Date: Fri, 1 Jul 2022 12:04:41 +0200 From: Vincent Whitchurch To: David Gow CC: Andrey Konovalov , Dmitry Vyukov , Johannes Berg , Patricia Alfonso , Jeff Dike , Richard Weinberger , "anton.ivanov@cambridgegreys.com" , Brendan Higgins , Andrew Morton , Andrey Ryabinin , kasan-dev , "linux-um@lists.infradead.org" , LKML , Daniel Latypov , "linux-mm@kvack.org" , "kunit-dev@googlegroups.com" Subject: Re: [PATCH v4 2/2] UML: add support for KASAN under x86_64 Message-ID: <20220701100441.GA8082@axis.com> References: <20220630080834.2742777-1-davidgow@google.com> <20220630080834.2742777-2-davidgow@google.com> <20220630125434.GA20153@axis.com> <20220701091653.GA7009@axis.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=axis.com header.s=axis-central1 header.b=BxifDh2c; dmarc=pass (policy=none) header.from=axis.com; spf=pass (imf13.hostedemail.com: domain of Vincent.Whitchurch@axis.com designates 195.60.68.17 as permitted sender) smtp.mailfrom=Vincent.Whitchurch@axis.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656669884; a=rsa-sha256; cv=none; b=YYp7w9wctVW3SrxEYrYqn19d0o+ECzyj7IOI8AUM5n9LNG/jLmTLzwmhQJZYd3g0BxZ1kp gFAm6A39pSEermoPoWhu6oQHCQhzSi/WSc3CAwVTRj4IOYoK8Mx/c9yl50WM+B3dyfdGHM MmS9jj5yXjR22JEwcc/GIVFm6ttuxC4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656669884; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=C9yKLAcuZ5hnkYBCpoRQx1zMhVYu01vnHM+Lplb5HMc=; b=MEXwoqvsSIU/jCwvDyHKEYgO5KY7mOJ8qlBDficV0TVCF1fKAzY6t/JWABX36xuhyooae/ L+5+Z0xtzIq2NBpWK6oNTHm/MJVvhrgjsuQchxWjLes8maRlZJO5XcT1sxb/AFtc3s/e9P zjFTh0Ygy96tuBQVK8CmIDOf2300sFU= X-Rspam-User: Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=axis.com header.s=axis-central1 header.b=BxifDh2c; dmarc=pass (policy=none) header.from=axis.com; spf=pass (imf13.hostedemail.com: domain of Vincent.Whitchurch@axis.com designates 195.60.68.17 as permitted sender) smtp.mailfrom=Vincent.Whitchurch@axis.com X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: E04342004A X-Stat-Signature: tjqrg5gx3k1su6rkhnc917axxprwtx4c X-HE-Tag: 1656669883-514852 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: On Fri, Jul 01, 2022 at 05:43:26PM +0800, David Gow wrote: > On Fri, Jul 1, 2022 at 5:16 PM Vincent Whitchurch > wrote: > > On Fri, Jul 01, 2022 at 11:08:27AM +0200, David Gow wrote: > > > On Thu, Jun 30, 2022 at 9:29 PM Andrey Konovalov wrote: > > > > Stack trace collection code might trigger KASAN splats when walking > > > > stack frames, but this can be resolved by using unchecked accesses. > > > > The main reason to disable instrumentation here is for performance > > > > reasons, see the upcoming patch for arm64 [1] for some details. > > > > > > > > [1] https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/commit/?id=802b91118d11 > > > > > > Ah -- that does it! Using READ_ONCE_NOCHECK() in dump_trace() gets rid > > > of the nasty recursive KASAN failures we were getting in the tests. > > > > > > I'll send out v5 with those files instrumented again. > > > > Hmm, do we really want that? In the patch Andrey linked to above he > > removed the READ_ONCE_NOCHECK() and added the KASAN_SANITIZE on the > > corresponding files for arm64, just like it's already the case in this > > patch for UML. > > Personally, I'm okay with the performance overhead so far: in my tests > with a collection of ~350 KUnit tests, the total difference in runtime > was about ~.2 seconds, and was within the margin of error caused by > fluctuations in the compilation time. > > As an example, without the stacktrace code instrumented: > [17:36:50] Testing complete. Passed: 364, Failed: 0, Crashed: 0, > Skipped: 47, Errors: 0 > [17:36:50] Elapsed time: 15.114s total, 0.003s configuring, 8.518s > building, 6.433s running > > versus with it instrumented: > [17:35:40] Testing complete. Passed: 364, Failed: 0, Crashed: 0, > Skipped: 47, Errors: 0 > [17:35:40] Elapsed time: 15.497s total, 0.003s configuring, 8.691s > building, 6.640s running OK, good to know. > That being said, I'm okay with disabling it again and adding a comment > if it's slow enough in some other usecase to cause problems (or even > just be annoying). That could either be done in a v6 of this patchset, > or a follow-up patch, depending on what people would prefer. But I'd > not have a problem with leaving it instrumented for now. I don't have any strong opinion either way either, so you don't have to change it back on my account. Thanks.