Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1026253rwd; Sat, 27 May 2023 09:56:02 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7pI6taTvPC9OL5IWcibXHtDqlcg64zRCcsV4MGktXlytMqjd7hYfBY3bTyLTmZYEJMkRqu X-Received: by 2002:a05:6a21:6d92:b0:10a:e8b1:34bb with SMTP id wl18-20020a056a216d9200b0010ae8b134bbmr3987953pzb.56.1685206562197; Sat, 27 May 2023 09:56:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685206562; cv=none; d=google.com; s=arc-20160816; b=qSAfElM/EjaaGMgUi0/hjmLJap7s8lY2tj+tJNKJdgPGxXKolytbHLwOCX/D7eYVSc yUus6CYZB7236qRLeDH1nmW2ayBLnYe/Knu/DkmhFWQmM7Bv++GxlTlegh5FopaWoV7l 8PbPjOQ3tJdpMp4W7nwErhTRhTr7R2F7zFMguKu3PDwNMUbZxl5kNhweJlS1ukyT8ymT spiyjcVKHu/e5Fk4Bl/RwmF1mUcjVgKVxFB+98BYdSMdkvdARZ5f56lFWM+YAicnkXte 9pRlA2V7THlDNWlSh6vl2+BLgpGpACS7bXO8BdbRazs2D2PAxfn6EpgKqtXnff3uaGPF OXMg== 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=I/bw27vS3UVZGByGOfLoz+Tva7cynCfUs6ZBWXI06bo=; b=kVe2DS/WWIwA8m3HYVW0Ov4l6XQUZnH3iAp5nVhYn2gkLm/x1/9PW7K3TwfO2TTpHw /So2HxbjRucobn+uV5OpaNkZIpRzlCcam5KxE/gFuRkaGYyfKPSSleI9uZBzhwxMmFIQ O9SuJS4hVSlCsjNg0vR+wS3kzxpNXVajmwE7dZ2ftHFOiB4hARxF1nZQBdw4upvNIVjH Qqg2E+bHH7l07H/3i0HGoWlavO2vrdvQWe/Nq2H0AF4DCRdJdVkYl7ybNNhtTqUi/jj6 K4As07OiBck8JvUsXlKaDTXQPs5Wsi8PnqMaYeepFzrFZ4bFOgMdgF+m9Lh7lxCVoO4A LtPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=T9rdZ8CA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s10-20020a170902ea0a00b001a988a09b6esi7570015plg.252.2023.05.27.09.55.45; Sat, 27 May 2023 09:56:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=T9rdZ8CA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231693AbjE0QMu (ORCPT + 99 others); Sat, 27 May 2023 12:12:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229501AbjE0QMt (ORCPT ); Sat, 27 May 2023 12:12:49 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF003C7 for ; Sat, 27 May 2023 09:12:47 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-510f525e06cso3133754a12.2 for ; Sat, 27 May 2023 09:12:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1685203966; x=1687795966; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=I/bw27vS3UVZGByGOfLoz+Tva7cynCfUs6ZBWXI06bo=; b=T9rdZ8CAEEk2bwYl04RlNrdIw1fR0aZAtgEkRhT1ywPBV5ljidGU1zkHPG7XuRkavG 0ldhVFgA/+nuYwudhD8SkCHF0F+9mZeET9tUkJ7H19OO7a436jmmsH02rfu9iXl6Mls6 +bQEh76AYnTrCMsvy42HbavxbjHEAJetWtPXM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685203966; x=1687795966; 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=I/bw27vS3UVZGByGOfLoz+Tva7cynCfUs6ZBWXI06bo=; b=KCt86ikqzPKFR2prXQ0PzZTJYJ1e4EGxse0aEk/0Wd2ea8GXRtxqUB6IVCQrufJCLG bZwCV4oHvQhJJ+Tp2TnpDwDLwGh5kN0zvapzBNzih9Krw7rUf8wEe3oNqqPveKrt0CsS jmIPmat/iue9X+Tq0F6hCf+6x7f3yYOrO/wDDIb/zFQGPPxWqJIbi3vYxe9pgbEgI1Rh ZHOnvE6UTU+B02Voq9jUBO+Omtkbb40d6tRmkb6ZdYLTgbOwAGHe5JgzqkfLGYPz8Ken MfWANCXfottqEfDHocu3XitTR8GKV9aBxI5GIWKRAvqvKg1kkXf2/Wfcgmu72tzTy2i3 Cg9Q== X-Gm-Message-State: AC+VfDwVIh6XqpHrPRAXGNmLexlsDT9Rbh3hbGnLt/BnfU/q1UwI7GDG kTkYQrg6zSWZLdf727E7S2a0EUc1WHheRGSBDsVXPzbi X-Received: by 2002:a17:907:6092:b0:966:1984:9d21 with SMTP id ht18-20020a170907609200b0096619849d21mr6957302ejc.9.1685203966068; Sat, 27 May 2023 09:12:46 -0700 (PDT) Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com. [209.85.208.42]) by smtp.gmail.com with ESMTPSA id r20-20020a170906365400b0094e7d196aa4sm3507700ejb.160.2023.05.27.09.12.44 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 27 May 2023 09:12:44 -0700 (PDT) Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-51478f6106cso2714843a12.1 for ; Sat, 27 May 2023 09:12:44 -0700 (PDT) X-Received: by 2002:a17:907:3607:b0:96f:7b4a:2909 with SMTP id bk7-20020a170907360700b0096f7b4a2909mr5884052ejc.26.1685203964300; Sat, 27 May 2023 09:12:44 -0700 (PDT) MIME-Version: 1.0 References: <20230522025124.5863-1-michael.christie@oracle.com> <20230522025124.5863-4-michael.christie@oracle.com> <20230522123029.GA22159@redhat.com> <20230522174757.GC22159@redhat.com> <20230523121506.GA6562@redhat.com> <87bkib6nxr.fsf@email.froward.int.ebiederm.org> <20230524141022.GA19091@redhat.com> <87ttw1zt4i.fsf@email.froward.int.ebiederm.org> <20230525115512.GA9229@redhat.com> <87y1lcxwcj.fsf@email.froward.int.ebiederm.org> <87cz2mrtnk.fsf@email.froward.int.ebiederm.org> In-Reply-To: <87cz2mrtnk.fsf@email.froward.int.ebiederm.org> From: Linus Torvalds Date: Sat, 27 May 2023 09:12:27 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 3/3] fork, vhost: Use CLONE_THREAD to fix freezer/ps regression To: "Eric W. Biederman" Cc: Oleg Nesterov , Mike Christie , linux@leemhuis.info, nicolas.dichtel@6wind.com, axboe@kernel.dk, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, mst@redhat.com, sgarzare@redhat.com, jasowang@redhat.com, stefanha@redhat.com, brauner@kernel.org Content-Type: multipart/mixed; boundary="000000000000aae9aa05fcaf1f14" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --000000000000aae9aa05fcaf1f14 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, May 27, 2023 at 2:49=E2=80=AFAM Eric W. Biederman wrote: > > The real sticky widget for me is how to handle one of these processes > coredumping. It really looks like it will result in a reliable hang. Well, if *that* is the main worry, I think that's trivial enough to deal wi= th. In particular, we could make the rule just be that user worker threads simply do not participate in core-dumps. THAT isn't hard. All we need to do is (a) not count those threads in zap_threads() (b) make sure that they don't add themselves to the "dumper" list by not calling "coredujmp_task_exit()" (c) not initiate core-dumping themselves. and I think that's pretty much it. In fact, that really seems like a good model *regardless*, because honestly, a PF_IO_WORKER doesn't have valid register state for the core dump anyway, and anything that would have caused a IO thread to get a SIGSEGV *should* have caused a kernel oops already. So the only worry is that the core dump will now happen while an IO worker is still busy and so it's not "atomic" wrt possible VM changes, but while that used to be a big problem back in the dark ages when we didn't get the VM locks for core dumping, that got fixed a few years ago because it already caused lots of potential issues. End result: I think the attached patch is probably missing something, but the approach "FeelsRight(tm)" to me. Comments? Linus --000000000000aae9aa05fcaf1f14 Content-Type: text/x-patch; charset="US-ASCII"; name="patch.diff" Content-Disposition: attachment; filename="patch.diff" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_li66x0ln0 IGZzL2NvcmVkdW1wLmMgICB8ICAyICstCiBrZXJuZWwvZXhpdC5jICAgfCAgNiArKysrKysKIGtl cm5lbC9zaWduYWwuYyB8IDE4ICsrKysrKysrKystLS0tLS0tLQogMyBmaWxlcyBjaGFuZ2VkLCAx NyBpbnNlcnRpb25zKCspLCA5IGRlbGV0aW9ucygtKQoKZGlmZiAtLWdpdCBhL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