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 038FEC001DE for ; Mon, 31 Jul 2023 21:50:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7796F2800B1; Mon, 31 Jul 2023 17:50:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 702AF28007A; Mon, 31 Jul 2023 17:50:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 57BFA2800B1; Mon, 31 Jul 2023 17:50:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 43F8F28007A for ; Mon, 31 Jul 2023 17:50:28 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 1BB731402CA for ; Mon, 31 Jul 2023 21:50:28 +0000 (UTC) X-FDA: 81073251336.21.6012262 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by imf07.hostedemail.com (Postfix) with ESMTP id D4EB04000D for ; Mon, 31 Jul 2023 21:50:24 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=KPdLIRgb; spf=pass (imf07.hostedemail.com: domain of olsajiri@gmail.com designates 209.85.128.48 as permitted sender) smtp.mailfrom=olsajiri@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690840226; a=rsa-sha256; cv=none; b=bdjo/XIGDtvc/K7GWTh522vBoEKPnEvGHxLPEsLy6jVrFm+xIEGVGaaTRFN2DcOFDq9Vbk 8watoCCCLTwfzjfKfb4gmympJwfOKr6XW79EgNQGL9MEamnx02t5OJCL+1XSI5j4z9xP/p dNx2PN59TMbvqpSDcqNyUtJKjueeYQM= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=KPdLIRgb; spf=pass (imf07.hostedemail.com: domain of olsajiri@gmail.com designates 209.85.128.48 as permitted sender) smtp.mailfrom=olsajiri@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690840226; 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=mfZo16Tt9kvpNfsLlO4ki6ZdRkbvVDogdV8NnQudSyc=; b=oDvwRpJ1OLlEKwaRxI7isD40LfWBAterYVTUkaefI834vawXHNrF8FYbv0HDTKzMZflBYo YedgCIzBWKqDsHtvWrEztu040ThVHjjBA8NOgg1VwgyBOsDVF+r9uKG79YKldfFn3ZlMCD q9U8nEXcJA0jofu9TVHflGT93hn0wK8= Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-3fe078dcc3aso31723705e9.2 for ; Mon, 31 Jul 2023 14:50:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690840224; x=1691445024; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=mfZo16Tt9kvpNfsLlO4ki6ZdRkbvVDogdV8NnQudSyc=; b=KPdLIRgbDvS/UkjfhhaOrpJGjubdJRib5xeU+gS66Y5Otf5FZZ30bopbJn7HJ8i1Qe Kv1HCyAtQdna5OHQ/GhvjvBrU+aI93TDBV7vftufjYH6/XfRMM55at6Oq3hy+CSgVPd3 ZAKjHu19h4wu4alrJrHUHbxEPs8yyNhwm/U/LEaCwU7i0aSgSToKHS/FwFDSkA2C1yFx zRpywd9CgIuJAqESFCHjWp8FaxIZL65RiVMnsyPdAWNCtOyhCX3vzcwKEb7oBieiLbOT k17vv2O2dkvW+iqwTjdMCrgZlj3G6m4QiVAnkbyScauCspmoz/V762dUV72akBEWJHkC 8VAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690840224; x=1691445024; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=mfZo16Tt9kvpNfsLlO4ki6ZdRkbvVDogdV8NnQudSyc=; b=dYBNPb35meH6B4CfwyMDcx0pUc2GLNRUuXFkDUst8H1BzdbBfBZD8B0DI0trEfs+ye g5iS41vIYVt71JZAkQJ6TvHMJAYAlPbt60di9PAtMgkOl8FOtkdTxTFJgS36EQddLlmM tA11cgogOncTEamQ+5sHqYcp6q5vlUgIa6lRzleCUAfSdeNEAieJLpTm1SrtiuIr3QAn dHN4vvYS8uvzJ0pKylPiAQl3wGQ3SVcJizLg4b75KFPP4Tle7zXA9fxYy5xF42hnyR2+ 9qy0E9AYk6IchCFgCVGERadlQcjJirCgUr0uRdJtRk8eomi0lN5j3++DgpspFMx8rN+Y MSJA== X-Gm-Message-State: ABy/qLaBtJG9+WQUx/CuKwJ8PUUeS4CAFJNXmGkcVnm7VktHYoaTmO+5 j7MEdIRrFy/VFFkCTx0fwq4= X-Google-Smtp-Source: APBJJlFaRkxW/ieEkekJ3sX1GE84qtRUOLcKzOhbbtSysFsdIn08kU/mBuJlOnNyXLPA0gLwsqxKsQ== X-Received: by 2002:a1c:f202:0:b0:3f9:b430:199b with SMTP id s2-20020a1cf202000000b003f9b430199bmr909451wmc.15.1690840224278; Mon, 31 Jul 2023 14:50:24 -0700 (PDT) Received: from krava ([83.240.60.220]) by smtp.gmail.com with ESMTPSA id hn8-20020a05600ca38800b003fe29dc0ff2sm118333wmb.21.2023.07.31.14.50.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 14:50:23 -0700 (PDT) From: Jiri Olsa X-Google-Original-From: Jiri Olsa Date: Mon, 31 Jul 2023 23:50:22 +0200 To: Lorenzo Stoakes Cc: Jiri Olsa , David Hildenbrand , Baoquan He , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Andrew Morton , Uladzislau Rezki , Matthew Wilcox , Liu Shixin , Jens Axboe , Alexander Viro Subject: Re: [PATCH v8 1/4] fs/proc/kcore: avoid bounce buffer for ktext data Message-ID: References: <86fd0ccb-f460-651f-8048-1026d905a2d6@redhat.com> <32b8c5e4-c8e3-0244-1b1a-ca33bd44f38a@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: D4EB04000D X-Stat-Signature: zgmbbhgiaj4ouxn8io9dghundjd4yu35 X-Rspam-User: X-HE-Tag: 1690840224-324910 X-HE-Meta: U2FsdGVkX1+f5v2o5smnnwpvzFdWFAtsnPxuYsRhK2IUr7MugTlXJW/qxwWjbJZ4TfQxPs3jbtL3frBfIhi8L+9k5+Vf2bIDJmx0lCuma/fA6HsumJEZ7MyeFJuYsH2hY7qXqoKwXPThDi1urCzd5fVB+Ecl7tkVrNSn9TOxU105FFflPqeysWnuvPYpHdMCfKUYN1Bk/9wdOpk2SxkxNhdykcGozasOEgL0L6QObB/q5DP/8FJGAtQAsLrsA5jhb58beqdP9kLn5X7FXT7uxqbubdjPCaOmiBiDuphbsxSD+imdiLbaRjlWqELr+UVPODcFIIfK/gJrgHGtJ0ZcU+4LcAr4zr8VooJW4Zf9vBM2TzqMymfKkd2QJJ3qbD1lvFwsi6DM/PV3tW89ju5LtVofpAK7DlwReWZOFTMY5gH3t684vyXcAjQCEfLp3pYHyNl3wbQsz5h3hNdYzgKjmkSwVpe01BVTbScOftfWDD5krSikM5/mMNvGh7IjnDFxM91EVPFLE3z8pk342Kld3sCHnPqw1C8Ouvy7uBqBLLLIMk/yHadGG74OlNaK0Pl7Mz+SdkXWPDngakDOmZTBI4yF4kMJICnRr+0sXKoWkQUiI/fPWeFIwU8ivrHTaeu8uNZZerA0lFrhqelpI9g6XFuOLoScYy/jFZWbatVkrSyzMcIIgFtyh3TJX/p8YzL2CO20RotCeCquFbRMvFz1CSW6a10pnze5b7IKpFDylfWo27PBTIkAMDnyVzKVsZraxc5ATHlvisb0rryKSGdghASnNM69YfmB1SWCHbbfwJZIhiZvvVbU1mCj22FOPOnfmRUClucEo8F5wNCz6MgER7fwnT3m+R32eqBMwUHWSH1Cgy7NqScGDLPx8uR55uchdieARsHMP1Rvu0X1HpX9ryg2PLMmNazVZ2H5mHC5GUuMWNjxuTuk7mYvpKuZYS9E/S6gUHMCILvztv/bJsY v2NKXmyb dCN6vMp96Y/eY/CQCYZWkJHnf0vha48ZvWH6pIReMA2kfJcpGJzZRAgy0T9l9uFi1aPq3ql2IxyRzGD3djrnvH97yhKbEz7MBmPHEVeKWqxMwIQAZAfE+mIgKPjoeyYBXlhBYQs2BlIXaCOO7FTaULloGs2WQ+F1XIhfBkRNz2x4bjH7c5rNfNSd/6e4CWZV2aWlIlIO024biSlMUcfRvHdZFKh9q2xPH5tjDJxkwPFDoOusCmpfq1H6VxCjzi26NlI18i82HHzOb8cIgu/nAl7IUccn/KgbDhA2djSMtazYahVQhQE2ySA8RHLc/ET3DzgXqhZmVg/LboQflTe3ThU+5B1eEkGBslQSMGCeNf8acZxZ0VKsBhx4dCK5KXJe3vY7qoFIG5FnrESCc2gLUYQjgbAAbyNeKLpVn3zRDsUflKrCqZmQ5pLi1L2X7yCH9ypLyfgqP1OdinBmi59KLN9ibc7WE+rvar9oK 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 Mon, Jul 31, 2023 at 10:12:08PM +0100, Lorenzo Stoakes wrote: > On Mon, Jul 31, 2023 at 10:34:21PM +0200, Jiri Olsa wrote: > > On Mon, Jul 31, 2023 at 08:40:24PM +0100, Lorenzo Stoakes wrote: > > > On Mon, Jul 31, 2023 at 09:24:50PM +0200, David Hildenbrand wrote: > > > > On 31.07.23 21:21, Lorenzo Stoakes wrote: > > > > > On Mon, Jul 24, 2023 at 08:23:55AM +0200, David Hildenbrand wrote: > > > > > > Hi, > > > > > > > > > > > > > > > > > > > > I met this too when I executed below command to trigger a kcore reading. > > > > > > > I wanted to do a simple testing during system running and got this. > > > > > > > > > > > > > > makedumpfile --mem-usage /proc/kcore > > > > > > > > > > > > > > Later I tried your above objdump testing, it corrupted system too. > > > > > > > > > > > > > > > > > > > What do you mean with "corrupted system too" -- did it not only fail to > > > > > > dump the system, but also actually harmed the system? > > > > > > > > > > > > @Lorenzo do you plan on reproduce + fix, or should we consider reverting > > > > > > that change? > > > > > > > > > > > > -- > > > > > > Cheers, > > > > > > > > > > > > David / dhildenb > > > > > > > > > > > > > > > > Apologies I mised this, I have been very busy lately not least with book :) > > > > > > > > > > Concerning, I will take a look as I get a chance. I think the whole series > > > > > would have to be reverted which would be... depressing... as other patches > > > > > in series eliminates the bounce buffer altogether. > > > > > > > > > > > > > I spotted > > > > > > > > https://lkml.kernel.org/r/069dd40aa71e634b414d07039d72467d051fb486.camel@gmx.de > > > > > > > > > > Find that slightly confusing, they talk about just reveritng the patch but then > > > also add a kern_addr_valid()? > > > > > > I'm also confused about people talking about just reverting the patch, as > > > 4c91c07c93bb drops the bounce buffer altogether... presumably they mean > > > reverting both? > > > > > > Clearly this is an arm64 thing (obviously), I have some arm64 hardware let me > > > see if I can repro... > > > > I see the issue on x86 > > Ummmm what? I can't! What repro are you seeing on x86, exactly? # cat /proc/kallsyms | grep ksys_read ffffffff8151e450 T ksys_read # objdump -d --start-address=0xffffffff8151e450 --stop-address=0xffffffff8151e460 /proc/kcore /proc/kcore: file format elf64-x86-64 objdump: Reading section load1 failed because: Bad address jirka > > > > > > > > > Baoquan, Jiri - are you reverting more than just the one commit? And does doing > > > this go from not working -> working? Or from not working (worst case oops) -> > > > error? > > > > yes, I used to revert all 4 patches > > > > I did quick check and had to revert 2 more patches to get clean revert > > > > 38b138abc355 Revert "fs/proc/kcore: avoid bounce buffer for ktext data" > > e2c3b418d365 Revert "fs/proc/kcore: convert read_kcore() to read_kcore_iter()" > > d8bc432cb314 Revert "iov_iter: add copy_page_to_iter_nofault()" > > bf2c6799f68c Revert "iov_iter: Kill ITER_PIPE" > > ccf4b2c5c5ce Revert "mm: vmalloc: convert vread() to vread_iter()" > > de400d383a7e Revert "mm/vmalloc: replace the ternary conditional operator with min()" > > > > jirka > > That's quite a few more reverts and obviously not an acceptable solution here. > > Looking at > https://lore.kernel.org/all/CAA5enKaUYehLZGL3abv4rsS7caoUG-pN9wF3R+qek-DGNZufbA@mail.gmail.com > a parallel thread on this, it looks like the issue is that we are no longer > using a no-fault kernel copy in KCORE_TEXT path and arm64 doesn't map everything > in the text range. > > Solution would be to reinstate the bounce buffer in this case (ugh). Longer term > solution I think would be to create some iterator helper that does no fault > copies from the kernel. > > I will try to come up with a semi-revert that keeps the iterator stuff but > keeps a hideous bounce buffer for the KCORE_TEXT bit with a comment > explaining why...