Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp1066110rdb; Fri, 9 Feb 2024 09:13:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IED0BcVZvPGV4IepSjPAJGitApsoWQPyHtwT3A+2zNSJkSjd2QuYen4OUhFp0fJwq6mfV5G X-Received: by 2002:ac2:54a6:0:b0:511:724f:a7fa with SMTP id w6-20020ac254a6000000b00511724fa7famr1368102lfk.55.1707498824711; Fri, 09 Feb 2024 09:13:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707498824; cv=pass; d=google.com; s=arc-20160816; b=zEYbWaGeok3RM9W+891AKjRNxnKSh9TBluzHrNnQu3liydESEsJGrZbLF8E9f1RXMs TAbsjM+RPTGDszkH5ZnNa0cYSvWs8QXxITtnLa0IFK44EUXBDINRGNjfMUFIl20RAQEw PP1Il1qbdL/mYq4nXHvTGK4IAjT+nCL/546L7mFwItVrHsYVa2P+TXNOxLBpz/7d4jXa V+5Axvrg1e6hout+QEf7qDv4OGWA4NIt3VJkxdKjAwc6+P/dPmcvlvowl84rZWvLwdXg VxNOrXgOWjEBtYyzGARCYY7w/i+KwZqStZvMUo04ovevapeDDHQjNB1CkQgU7SG+Vytw q33g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:references:message-id:subject:cc:to:from:date :dkim-signature; bh=bsSvKc+Kdn9N6eOn3ZRNAwofM4fDjOQqakHK73VMHVY=; fh=QBaW9udV+Ee+x1Q3eZR4H6w2jh5M7Nmo1iD9h21g+jA=; b=hAiuuQOfaayiVgKGXUejqZIMZcnUJw1NSSRnEKzud8UcdSBcFp/P8dSxaxUJoPKXdK GH8zzcEB8PQIFc4lR/dnf6+rfgqh5Qw7n5PdfcfPbM7h9gRzy35drU9l7v465hCx6owu pA2VlZRGSrrBHZdUHxJepSDGSdatUfecOQ4DP/6b9ROq+jynQupGfh+aMG60lVR+66cL ZG6/hnzxElxJwYggPeJIMBWFELyZU2HXILTEaAvpFZBuvfSGTxRPX97yG1ltpWGto4cT QZDY8dzWwKc/KUEvQ4yjJoz8wCMBWMbVNBBhNdom8SuyIb669ITSKV4Z27KKOa5xxLL0 bI0A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Z9WFIsh9; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-59708-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59708-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCWoezv5rxMAMmIjIoeBtAPKpRN3D6Jy7GgPrvS5kX0ggMN1VKVq1Q6/uaNjRjXvfFmHPo1MvzBujuyi21L5K6pQ0vw5xV+D7wc94zUrGQ== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id o18-20020a17090608d200b00a379db1e480si1026001eje.379.2024.02.09.09.13.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 09:13:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59708-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Z9WFIsh9; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-59708-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59708-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 78BA21F2996C for ; Fri, 9 Feb 2024 17:12:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B891F33CF1; Fri, 9 Feb 2024 17:12:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Z9WFIsh9" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4A8D7BB08 for ; Fri, 9 Feb 2024 17:12:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707498721; cv=none; b=Uklr1QH/V17mtWahjiUWi7CT0mK8leF7NcUPp9cslKp9bkZZwiR9oF2wiQcRMlkyrDyToF77deQjRTen6Grf/4YrKLhpKoQ4S0f2UyPDebaoncw0yhEupn0eBPufP+3+M8+lPbtCgTYdDzsLkXaUC9804NTE3ZEE4ul2bbq+y4k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707498721; c=relaxed/simple; bh=QKvQt9YWW6uZWhy9ZXSZmB6o80HZsnRJY2SXeTLZtCs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=fp18Ij8Rk0z7/RdcDOTZms65h4VeMA9Ei1TgalRt2L0TH1opbsLTDWBpw9MMgQXc+9JSyb+EsYxLJOaexjGY+uDFRcZJ7pMC0sYa3c/jyWWbBRY8+9Xa+L8jRdHwhKdi0hzCZnLWCIqFu9WpduY27SO/anwsDPCZO803X+v+iQI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Z9WFIsh9; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CADEDC43390; Fri, 9 Feb 2024 17:11:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707498720; bh=QKvQt9YWW6uZWhy9ZXSZmB6o80HZsnRJY2SXeTLZtCs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Z9WFIsh9rUY2t9gwyaB2PnmT4eEZUbPWSWlqv+m0mpoX5qQbhPziVmunrZhBrmYWV 3p/VTpPxPNb7TwVtB2zxxYzqwaAqKvyQXktd69erDVMFx3ibrFECD6SF8MoC50g1rW 8KwTmhKq2pGPXLB2GPxYO5Lv+PNHAoasMlcC9ZmwS+ybAyqrbLXSbpuPqmTuSptK8C g8M+xp6n766X2gi9bH2jjP0EQk5rl+3lB+RUgq4vld1BtOqlASXeY72UCT1Vu46yAX n+6plub8uQQrTlO9V0CAwr2Q9n2kaYh1YACbICmVxg8d3wrXgIw3cgqnreeftH8z4z 2NnS6km13lPOQ== Date: Fri, 9 Feb 2024 17:11:55 +0000 From: Will Deacon To: Doug Anderson Cc: Mark Brown , Catalin Marinas , Dave Martin , Oleg Nesterov , Al Viro , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] arm64/sve: Lower the maximum allocation for the SVE ptrace regset Message-ID: <20240209171155.GB25069@willie-the-truck> References: <20240203-arm64-sve-ptrace-regset-size-v1-1-2c3ba1386b9e@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Hi Doug, On Mon, Feb 05, 2024 at 09:02:08AM -0800, Doug Anderson wrote: > Hi, > > On Sat, Feb 3, 2024 at 4:18 AM Mark Brown wrote: > > > > Doug Anderson observed that ChromeOS crashes are being reported which > > include failing allocations of order 7 during core dumps due to ptrace > > allocating storage for regsets: > > > > chrome: page allocation failure: order:7, > > mode:0x40dc0(GFP_KERNEL|__GFP_COMP|__GFP_ZERO), > > nodemask=(null),cpuset=urgent,mems_allowed=0 > > ... > > regset_get_alloc+0x1c/0x28 > > elf_core_dump+0x3d8/0xd8c > > do_coredump+0xeb8/0x1378 > > > > with further investigation showing that this is: > > > > [ 66.957385] DOUG: Allocating 279584 bytes > > > > which is the maximum size of the SVE regset. As Doug observes it is not > > entirely surprising that such a large allocation of contiguous memory might > > fail on a long running system. > > > > The SVE regset is currently sized to hold SVE registers with a VQ of > > SVE_VQ_MAX which is 512, substantially more than the architectural maximum > > of 16 which we might see even in a system emulating the limits of the > > architecture. Since we don't expose the size we tell the regset core > > externally let's define ARCH_SVE_VQ_MAX with the actual architectural > > maximum and use that for the regset, we'll still overallocate most of the > > time but much less so which will be helpful even if the core is fixed to > > not require contiguous allocations. > > > > We could also teach the ptrace core about runtime discoverable regset sizes > > but that would be a more invasive change and this is being observed in > > practical systems. > > > > Reported-by: Doug Anderson > > Signed-off-by: Mark Brown > > Confirmed that when I send a "quit" signal to Chrome now that the > allocation I see for "core_note_type" NT_ARM_SVE goes down from > 279,584 bytes (n=17474) to just 8,768 bytes (n=548). I'm not > intimately familiar with this code so I'll skip the Reviewed-by unless > someone thinks it would be valuable for me to analyze more. I think > there are already plenty of people who know this well, so for now, > just: > > Tested-by: Douglas Anderson I can pick this up as a short-term hack if it solves the problem for you, but I also saw that you posted: https://lore.kernel.org/r/20240205092626.v2.1.Id9ad163b60d21c9e56c2d686b0cc9083a8ba7924@changeid to fallback onto vmalloc() for large allocations. What's your preference for a fix? Cheers, Will