Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3431482rdg; Tue, 17 Oct 2023 14:54:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH2RonFaJIhi4G3OWafZeQ581bco1jXtqqbazdwAzb1TeauZZbRZg0Xo4McvTSVMRa75tpF X-Received: by 2002:a05:6a20:da8b:b0:17b:2c56:70b8 with SMTP id iy11-20020a056a20da8b00b0017b2c5670b8mr1612810pzb.22.1697579645738; Tue, 17 Oct 2023 14:54:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697579645; cv=none; d=google.com; s=arc-20160816; b=wFkszS/lfwtA6lczyiZMDVK0LUDcA1ITdgwDWLNy/PFdFYL7GHSpuacBzQD32Ah1TB u2GEuFMnoAEEmyKYkfBg1GnYQOH6d9d1Ecmgx0NcyIdbJVbLtSR3m559FqstxxA4OLuU wkfshHUy7rRGWcERHGgo3qBiiBDqGfXLZ/8axI9pDyiRpK1jdA3kkt7zATPT1O/DrGUn NLbcu4CiJQ5PALdSHChBWCkp/PM+qiRBDlX/IkewuNTOGpjKx4/WHZaEkhpt9QTGiKv+ j/MOMWl8XOU0HkELob3nWE4A+8ybY0z9dEMiYKFJu81kLWuiQmpTEanrb8LP9SdwZICt H28A== 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=psxzYy8Ro6VCd0vtaHbgahw7/JWUti7oPPeTmbqEN7o=; fh=3hMqaci1aSMG0AFmuDTcNcT9Fdla45I/j/Dj+Dy/pas=; b=PNj6gwKYf9aUNpYK8lKRhIP/APGPbBdkTczElyiNyieMP5nnjUAU2v1PIryhP277R9 7WXXsV249yJy2Uh6ig4ZopgOagKephfBmFh73vxFDXPRa3DECquat/o6PeE5fVsU7wl2 F9zdKxkU1ClR1CjruXBv19hO+E39GQ2QaFcoKhsDT3feIX//cCS/kbB1s20EYrk0J+KZ JJcJdKSd8SgdxlbusrZmQxJNff72OuRHmgU/MNvneVJ4ilaQ7pnbxNYJJzmLjuBm8Xhf lEvMigl36pteWF83DoGkU6gKpBSF8RcLSaWM+eoSU7kPobGaz/bq6M09oac0wK8PrP1c XtRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=PviMAFjm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id d68-20020a633647000000b00578b4992008si725715pga.133.2023.10.17.14.54.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 14:54:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=PviMAFjm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 89BB5808BCAD; Tue, 17 Oct 2023 14:54:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233549AbjJQVx5 (ORCPT + 99 others); Tue, 17 Oct 2023 17:53:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230056AbjJQVxz (ORCPT ); Tue, 17 Oct 2023 17:53:55 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25DB0B0 for ; Tue, 17 Oct 2023 14:53:54 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-9b1ebc80d0aso969706866b.0 for ; Tue, 17 Oct 2023 14:53:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1697579632; x=1698184432; 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=psxzYy8Ro6VCd0vtaHbgahw7/JWUti7oPPeTmbqEN7o=; b=PviMAFjmQlBe39l+CiUpy8lAgv3LnR19JBAVxakMoarbksmaSI2boIW1zM7un9IsVi Ui5pRxSoj5+txLC+2dpT6Yt/qom+Fcl1syBUizMqXnb6jee7fZ9XYR2BIY62nlJ+el2g WZKDlIowslBgSqi5TRn16rnGadiVMB7awMBj4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697579632; x=1698184432; 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=psxzYy8Ro6VCd0vtaHbgahw7/JWUti7oPPeTmbqEN7o=; b=s72zq5JmJejoMDztt86Z8iC1PKQee8zAF6cqk86noDdJY1K2+CGE20PANWbJsacT6F g/FqWZ9XtukjKVLlMMiQplzHKTrZsAFarWy1VStEUu7im1C2JiuC73ElnqMlpWai2Uqf VIMdH3rhQddeX9PWijmENgAD/hUyF11JlTJJn0+A1K6DGF3QbDVx9Qa0e7Y1RhTvWVxs 9NU08OOaqPpIyezDf+cK421U2UQxRnsjwQi7QkleVNM3yiD6QxWjCWufPBNHHmYH86CD SAMvh7K0+Antqu0mDPAtzXJv/6F0qBRmNnavtWgGtjXxYXCgapVXq0YaibMP4ydzT5mK a9Bw== X-Gm-Message-State: AOJu0YyvwQNaQIKZ1XaZhsr3MsLf9rJnG4mvt+kmOt/sthX4W6Az0ZxV rKt0v6k+agV3628fw0tGSUBcsTKnRqWZKZ802MOeWKmz X-Received: by 2002:a17:907:3fa3:b0:9bd:c592:e0ce with SMTP id hr35-20020a1709073fa300b009bdc592e0cemr2782381ejc.51.1697579632545; Tue, 17 Oct 2023 14:53:52 -0700 (PDT) Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com. [209.85.208.46]) by smtp.gmail.com with ESMTPSA id k19-20020a170906579300b0099bd5d28dc4sm429455ejq.195.2023.10.17.14.53.51 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 17 Oct 2023 14:53:51 -0700 (PDT) Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-5384975e34cso10918680a12.0 for ; Tue, 17 Oct 2023 14:53:51 -0700 (PDT) X-Received: by 2002:a17:907:25c4:b0:9c4:4b20:44b2 with SMTP id ae4-20020a17090725c400b009c44b2044b2mr2580462ejc.23.1697579631483; Tue, 17 Oct 2023 14:53:51 -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: Linus Torvalds Date: Tue, 17 Oct 2023 14:53:33 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 -tip] x86/percpu: Use C for arch_raw_cpu_ptr() To: Uros Bizjak 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: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 howler.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 (howler.vger.email [0.0.0.0]); Tue, 17 Oct 2023 14:54:03 -0700 (PDT) On Tue, 17 Oct 2023 at 14:06, Uros Bizjak wrote: > > But adding the attached patch on top of both patches boots OK. Funky. Mind adding a WARN_ON_ONCE(!active_mm); to there to give a nice backtrace for the odd NULL case. That code *is* related to 'current', in how we do tsk = current; ... local_irq_disable(); active_mm = tsk->active_mm; tsk->active_mm = mm; tsk->mm = mm; ... activate_mm(active_mm, mm); ... mmdrop_lazy_tlb(active_mm); but I don't see how 'active_mm' could *poossibly* be validly NULL here, and why caching 'current' would matter and change it. Strange. Hmm. We do set tsk->active_mm = NULL; in copy_mm(), and then we have that odd kernel thread case: /* * Are we cloning a kernel thread? * * We need to steal a active VM for that.. */ oldmm = current->mm; if (!oldmm) return 0; but none of this should even matter, because by the time we actually *schedule* that thread, we'll set active_mm to the right thing. Can anybody see what's up? Linus