Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3362302rdg; Tue, 17 Oct 2023 12:12:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFRqU3vo0xCJvlIfWDa6EJtTx5S4m5Fk9zTgwOG+xDpB/I1p0fA72y9gje4dyOReLj5cpzz X-Received: by 2002:a17:90b:2812:b0:27d:2770:f3e with SMTP id qb18-20020a17090b281200b0027d27700f3emr2848376pjb.27.1697569942721; Tue, 17 Oct 2023 12:12:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697569942; cv=none; d=google.com; s=arc-20160816; b=B+EI96P4a/B0BYvSUL1TbQ5dujqZKG7hEOPPS/oC5tNMCo6bMvSMA/a8NrM6D8j+wk 5TWamLC6aTc+NZq6hNrN7JtyxX8rTGT63/xLenC5b8SJUG8viECZr1JIL1+5OT4QwGpJ x/WNPOVq/mOFZmVOSxIqq3YFhmX8u8SVM4vyQBow5IcF8J+5D9C6G2UgY8MPbcfeTUIm X83dHROy7SJS9NPJeO7Mpoh+nmYRmBTf7kBEUR8fvc81an2pVqKWreF79gUjwITnOl12 aOYCl2Lv4F7LLZFHeHLst2ZZnEQ7LJS3nGi/oNFQJBR3SBZbSMkLoTH34TgDI22r7Yvi ao2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=zshnJXva4oUtLOMSpUQJEsw05K0Ofi7PiJbFvaGT/iM=; fh=/Dnf++/2xG0Xi30TGscvcX3UaoYjzLSxPPap0bUcRsE=; b=tkZdSLyMe3x5IOn4tebLQ2mrt5z5wuRGWIjNqnRi7dfHpzjOD1lJQ/7ltEMm2pqYA6 y4tNHTnSXt2+ACwB4k4jz2L4LogW2h8hOnv65qlMtNVFrFsyvFCnm2lFLZJtyw9UtRBw 5CcyhKlIVr0wQuIZN5aZfd4eDw35gB5o6N1kiteGrKgW+32Tv/rmsUXt2kvOA6s5qkgz L8W4nvEf61VIe2hJjMDfP+YSdoTeB41yyk6t43B9N5WLgSLJ6qZf+5DBQZYdfD2DTtX3 iyRqXF3kCc0I8EXgHIyIw6/I4SL+uWSq+7/gh4151u0x6EW+kMqymIF4y1TJF1vwTqi0 Npgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ePKEP7hQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id h1-20020a17090ac38100b00274d6373fe1si9205558pjt.120.2023.10.17.12.12.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 12:12:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ePKEP7hQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id B786C801B9E0; Tue, 17 Oct 2023 12:12:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344106AbjJQTMD (ORCPT + 99 others); Tue, 17 Oct 2023 15:12:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343642AbjJQTMC (ORCPT ); Tue, 17 Oct 2023 15:12:02 -0400 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28E3590 for ; Tue, 17 Oct 2023 12:12:00 -0700 (PDT) Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-53f3609550bso881454a12.1 for ; Tue, 17 Oct 2023 12:12:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697569918; x=1698174718; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=zshnJXva4oUtLOMSpUQJEsw05K0Ofi7PiJbFvaGT/iM=; b=ePKEP7hQnOK8vad0aaM64Eb0Oj1keZQjD3tOx+igK712fdO+ZXcHRVUy7AUxkYRzru GsU2BGo9Hpgt0mB+LLsWa0uAzYRc2MnS4xIqYMk1zxDYAUsWNNFcd9rPH3VxOpdN37ta zXS2BSMYnhC4gd+W8lqqiGzOenAMbAGJwi6+hTP8T7zmyPfXr0wfvEF6hplnZTkaHWA5 fDfKtpluLHC+zwcnLuTCSSe/PUZ7eQBjKqvkwhGIZglGQoiYu3lSEkSD1t1JsPMHWult 01dWRcntkyp1Q7wbG0Sv/WCKo/UTILAICLeODLfq0QS6yYcHRhySuFaHxSxdv/FPJBnu gMgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697569918; x=1698174718; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zshnJXva4oUtLOMSpUQJEsw05K0Ofi7PiJbFvaGT/iM=; b=D6hN/2Mw/lOobdLcVa7b3JXmRwH9s4dfsdXHSIeaJe7rflTNFfFtPpjvDcHyM+g0Yc Gc3WP4OWLXK26lApbqs6HvrAOV6bYUJ9T+AeK7VZul88N1LpADIn2PcdgxII5WdtXG11 sIVd5GHApGCmmWSpoUf3SDrnszAuSeUvzBFH1kEFJ3P6Q4QXN/JvrDZ92bqCBL2ho0fp WZ3Bu00akaDs0+tUMAuXS0AUGnD2S55MXGrP549K+jl9J1pOpGlLhTtusebWHVbzg2Z+ zoDx/1TB3YkTiLzYVZXFCIepLrwil9/fcT4vPr0MS4pJjs4kxJryvULjhUNf8pGb0A6q AMfQ== X-Gm-Message-State: AOJu0YwgxlG/WfRGQ2xFXZzfXVIqVXOfWD79SmQEzOPw5FEQfl4lkwME Mjotiy6Yqv7h9C3d38hvOUPAG2Wo/ePugBrBIaU= X-Received: by 2002:a50:ab58:0:b0:53e:7d91:611f with SMTP id t24-20020a50ab58000000b0053e7d91611fmr2334224edc.11.1697569918355; Tue, 17 Oct 2023 12:11:58 -0700 (PDT) MIME-Version: 1.0 References: <20231010164234.140750-1-ubizjak@gmail.com> <0617BB2F-D08F-410F-A6EE-4135BB03863C@vmware.com> <7D77A452-E61E-4B8B-B49C-949E1C8E257C@vmware.com> <9F926586-20D9-4979-AB7A-71124BBAABD3@vmware.com> In-Reply-To: From: Uros Bizjak Date: Tue, 17 Oct 2023 21:11:46 +0200 Message-ID: Subject: Re: [PATCH v2 -tip] x86/percpu: Use C for arch_raw_cpu_ptr() To: Linus Torvalds Cc: Nadav Amit , "the arch/x86 maintainers" , Linux Kernel Mailing List , Andy Lutomirski , Brian Gerst , Denys Vlasenko , "H . Peter Anvin" , Peter Zijlstra , Thomas Gleixner , Josh Poimboeuf , Nick Desaulniers Content-Type: multipart/mixed; boundary="000000000000f723500607ee4b32" X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 17 Oct 2023 12:12:18 -0700 (PDT) --000000000000f723500607ee4b32 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Oct 17, 2023 at 9:00=E2=80=AFPM Linus Torvalds wrote: > > On Tue, 17 Oct 2023 at 00:23, Nadav Amit wrote: > > > > Yes, the FPU issue is the one that caused me to crash before. > > Uros, can you verify whether that patch of mine resolves the issue you sa= w? > > That patch is _technically_ an actual bug-fix, although right now our > existing 'current' caching that depends on just CSE'ing the inline asm > (and is apparently limited to only doing so within single basic > blocks) doesn't actually trigger the bug in our __switch_to() logic in > practice. Unfortunately, it doesn't fix the oops :( I'm testing your patch, together with the attached patch with the current tip tree (that already has all necessary percpu stuff), and get exactly the same oops in: [ 4.969657] cfg80211: Loading compiled-in X.509 certificates for regulatory database [ 4.980712] modprobe (53) used greatest stack depth: 13480 bytes left [ 4.981048] BUG: kernel NULL pointer dereference, address: 0000000000000= 000 [ 4.981830] #PF: supervisor write access in kernel mode [ 4.981830] #PF: error_code(0x0002) - not-present page [ 4.981830] PGD 0 P4D 0 [ 4.981830] Oops: 0002 [#1] PREEMPT SMP PTI [ 4.981830] CPU: 1 PID: 54 Comm: kworker/u4:1 Not tainted 6.6.0-rc6-00406-g84ab57184ff4-dirty #2 [ 4.981830] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-1.fc37 04/01/2014 [ 4.981830] RIP: 0010:begin_new_exec+0x8f2/0xa30 [ 4.981830] Code: 31 f6 e8 c1 49 f9 ff e9 3c fa ff ff 31 f6 4c 89 ef e8 b2 4a f9 ff e9 19 fa ff ff 31 f6 4c 89 ef e8 23 4a f9 ff e9 ea fa ff ff 41 ff 0c 24 0f 85 55 fb ff ff 4c 89 e7 e8 4b 02 df ff e9 48 fb [ 4.981830] RSP: 0000:ffffa505401f3d68 EFLAGS: 00010246 [ 4.981830] RAX: 0000000000000000 RBX: ffff89ed809e9f00 RCX: 00000000000= 00000 [ 4.981830] RDX: 0000000000000000 RSI: ffff89ed80e6c000 RDI: ffff89ed809= ea718 [ 4.981830] RBP: ffff89ed8039ee00 R08: 00000000fffffffe R09: 00000000fff= fffff [ 4.981830] R10: 000001ffffffffff R11: 0000000000000001 R12: 00000000000= 00000 [ 4.981830] R13: 0000000000000000 R14: ffff89ed809ea718 R15: ffff89ed80e= 6c000 [ 4.981830] FS: 0000000000000000(0000) GS:ffff89ee24900000(0000) knlGS:0000000000000000 [ 4.981830] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 4.981830] CR2: 0000000000000000 CR3: 00000001003a0000 CR4: 00000000000= 406f0 [ 4.981830] Call Trace: [ 4.981830] [ 4.981830] ? __die+0x1e/0x60 [ 4.981830] ? page_fault_oops+0x17b/0x470 [ 4.981830] ? search_module_extables+0x14/0x50 [ 4.981830] ? exc_page_fault+0x66/0x140 [ 4.981830] ? asm_exc_page_fault+0x26/0x30 [ 4.981830] ? begin_new_exec+0x8f2/0xa30 [ 4.981830] ? begin_new_exec+0x3ce/0xa30 [ 4.981830] ? load_elf_phdrs+0x67/0xb0 [ 4.981830] load_elf_binary+0x2bb/0x1770 [ 4.981830] ? __kernel_read+0x136/0x2d0 [ 4.981830] bprm_execve+0x277/0x630 [ 4.981830] kernel_execve+0x145/0x1a0 [ 4.981830] call_usermodehelper_exec_async+0xcb/0x180 [ 4.981830] ? __pfx_call_usermodehelper_exec_async+0x10/0x10 [ 4.981830] ret_from_fork+0x2f/0x50 [ 4.981830] ? __pfx_call_usermodehelper_exec_async+0x10/0x10 [ 4.981830] ret_from_fork_asm+0x1b/0x30 [ 4.981830] [ 4.981830] Modules linked in: [ 4.981830] CR2: 0000000000000000 [ 5.052612] ---[ end trace 0000000000000000 ]--- [ 5.053833] RIP: 0010:begin_new_exec+0x8f2/0xa30 [ 5.055065] Code: 31 f6 e8 c1 49 f9 ff e9 3c fa ff ff 31 f6 4c 89 ef e8 b2 4a f9 ff e9 19 fa ff ff 31 f6 4c 89 ef e8 23 4a f9 ff e9 ea fa ff ff 41 ff 0c 24 0f 85 55 fb ff ff 4c 89 e7 e8 4b 02 df ff e9 48 fb [ 5.059476] RSP: 0000:ffffa505401f3d68 EFLAGS: 00010246 [ 5.060780] RAX: 0000000000000000 RBX: ffff89ed809e9f00 RCX: 00000000000= 00000 [ 5.062483] RDX: 0000000000000000 RSI: ffff89ed80e6c000 RDI: ffff89ed809= ea718 [ 5.064190] RBP: ffff89ed8039ee00 R08: 00000000fffffffe R09: 00000000fff= fffff [ 5.065908] R10: 000001ffffffffff R11: 0000000000000001 R12: 00000000000= 00000 [ 5.067625] R13: 0000000000000000 R14: ffff89ed809ea718 R15: ffff89ed80e= 6c000 [ 5.069343] FS: 0000000000000000(0000) GS:ffff89ee24900000(0000) knlGS:0000000000000000 [ 5.071313] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 5.072732] CR2: 0000000000000000 CR3: 00000001003a0000 CR4: 00000000000= 406f0 [ 5.074439] Kernel panic - not syncing: Fatal exception [ 5.075028] Kernel Offset: 0xcc00000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff) Uros. --000000000000f723500607ee4b32 Content-Type: text/plain; charset="US-ASCII"; name="current.diff.txt" Content-Disposition: attachment; filename="current.diff.txt" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_lnup8xbz0 ZGlmZiAtLWdpdCBhL2FyY2gveDg2L2luY2x1ZGUvYXNtL2N1cnJlbnQuaCBiL2FyY2gveDg2L2lu Y2x1ZGUvYXNtL2N1cnJlbnQuaAppbmRleCBhMTE2OGU3YjY5ZTUuLjIxZThiZDRlYTQ0ZSAxMDA2 NDQKLS0tIGEvYXJjaC94OD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