Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2233817rwd; Mon, 15 May 2023 08:57:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6is3J8mThMYcs0KN0NtqaMN0aazqfvKi5V7HB1vEAjT7SUJofA7X/yTKtiaOGKs1hBBh+N X-Received: by 2002:a05:6a20:d2cb:b0:106:774c:8bc1 with SMTP id ir11-20020a056a20d2cb00b00106774c8bc1mr2135313pzb.48.1684166239436; Mon, 15 May 2023 08:57:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684166239; cv=none; d=google.com; s=arc-20160816; b=jst87gcAG47BZMM32/ELPPSpY6fCzdAefEVaEqzLmXLg26TLI1zmBEHUOqo+hNv3hz ljvNmHhcuP2DYjGKNmRjMM3avYg2wv8VRM0nPQES9Lecc15n43Uyn0H86PM1L8YG4jZ8 aD5p8+rraIcW3q28XGKhlaYr30UsmSWNuoIlMs7jCVInPIw5WFgLt617frhsU0mKk0FX Op/J07GjtTBHGpZY2kdPq9PGmm7fiMXuBaLCOJVhAteuqsThmUD63wQDo2vTzgXkqdnR 9XHq2vaeD+OclW8srcE2Wl6PMoFOx79iPiArAunqJEqTXQENQDAgz/pqOvBhpdxv+j34 sW3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=XPEGaC+x0TYEuX7HHgeWtz7pyNM4DGEHBqF/DDq7Iw0=; b=pMxIPEregz26o1IYlaqjKQf2ebdrKaCsMQY/x1RpBzWgRxBOJDDr7z1MPq6MgHQNPD RHOZYxbookiwM59pQKV4WyGbw4Df9ZdkI70sKQG21016aUVGujAiNLFBr5kV55J2POdK F+ciOiTXrqTuYaM48cu7t8Cr7vG2WUgXcpT5zdT+Q3B4tQfhhTFX4yUqeFAxBvdz9pJE /HQaUvgh+eXVZNoWbWlPvEnNplbszpXocRK800tzL1buZahtr7K1Ol8T/0uk9kguxq1g kiJtB/iBepaDvjyiGlT5dXWuBaCQck85ztKUtLnxGdxBfa4eDjcxke173u4uteBvioQj 1KbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=gImqqK7E; 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 b23-20020a637157000000b0051b8a81c5d0si16231198pgn.606.2023.05.15.08.56.56; Mon, 15 May 2023 08:57:19 -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=gImqqK7E; 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 S241866AbjEOPpP (ORCPT + 99 others); Mon, 15 May 2023 11:45:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbjEOPpO (ORCPT ); Mon, 15 May 2023 11:45:14 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43ADB1FCF for ; Mon, 15 May 2023 08:45:13 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-965d2749e2eso1954999866b.1 for ; Mon, 15 May 2023 08:45:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1684165511; x=1686757511; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=XPEGaC+x0TYEuX7HHgeWtz7pyNM4DGEHBqF/DDq7Iw0=; b=gImqqK7Ez4ILwctNY0AcR7B6kOcnLZLrABJErDV0yJSdTCJO24RZwul28fa1YXP4J5 bKoHYDUdz0GrdUt1uvyJRzrL7wHWnEE7CFgoVdIxKph77hkZpY5hXoE8CN2AnKNyhvPE 1WD55DRKkWgfPnF1cu9nglLrdj/x+IQwngXX0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684165511; x=1686757511; h=content-transfer-encoding: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=XPEGaC+x0TYEuX7HHgeWtz7pyNM4DGEHBqF/DDq7Iw0=; b=ZfdyG/DTGijqVVmC4Km6UQPcPwLk3wxCRotvq5ZZ92cpsrF0TfGtOENnItNpudxVBd 74o7EP59koOSQiEZPX6O3BamoCFDGe7wlK9UlhD/rIXcItI/Xf4KPqk2kqSFwjSbZD8W RNHp72JHFtvDnr49ZWrpMNwVAsryBUDlxruWmDF67mzKzEGJDIzUPUKxuDTy4QLirInE vlmQhCwUlsq7J+klq2vxGoDUgiEOrVMQRJ+vp28GqIDB3dd61eSh95+NDXPPU5/y91Zf Jr99UodXMGRFuhbRZTIoRgAgtcZVKQMSd263kFVQWVQfjR/rosJutcnx5gT3SDZR+ZW/ bGZg== X-Gm-Message-State: AC+VfDyp8CRx1uARHak+GyewMi1gP2KJHPcIMlQ5uthFZzs+hsN6JYkJ I9sQAcFAeVIqq6vSHW4MovgQEAtxXdIQbocokEQS4w== X-Received: by 2002:a17:907:1c9e:b0:96a:9c6:d75a with SMTP id nb30-20020a1709071c9e00b0096a09c6d75amr20164952ejc.24.1684165511184; Mon, 15 May 2023 08:45:11 -0700 (PDT) Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com. [209.85.218.49]) by smtp.gmail.com with ESMTPSA id ib8-20020a1709072c6800b0094f67ea6598sm9711885ejc.193.2023.05.15.08.45.09 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 May 2023 08:45:10 -0700 (PDT) Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-969f90d71d4so1250117766b.3 for ; Mon, 15 May 2023 08:45:09 -0700 (PDT) X-Received: by 2002:a17:907:70d:b0:94b:d57e:9d4b with SMTP id xb13-20020a170907070d00b0094bd57e9d4bmr30521770ejb.2.1684165509441; Mon, 15 May 2023 08:45:09 -0700 (PDT) MIME-Version: 1.0 References: <20230202232517.8695-1-michael.christie@oracle.com> <20230202232517.8695-9-michael.christie@oracle.com> <78c5e150-26cf-7724-74ee-4a0b16b944b1@oracle.com> <48842e92-835e-bc3f-7118-48b8f415f532@leemhuis.info> <20230515-vollrausch-liebgeworden-2765f3ca3540@brauner> In-Reply-To: <20230515-vollrausch-liebgeworden-2765f3ca3540@brauner> From: Linus Torvalds Date: Mon, 15 May 2023 08:44:52 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v11 8/8] vhost: use vhost_tasks for worker threads To: Christian Brauner Cc: Thorsten Leemhuis , Mike Christie , nicolas.dichtel@6wind.com, Linux kernel regressions list , hch@infradead.org, stefanha@redhat.com, jasowang@redhat.com, mst@redhat.com, sgarzare@redhat.com, virtualization@lists.linux-foundation.org, ebiederm@xmission.com, konrad.wilk@oracle.com, linux-kernel@vger.kernel.org, Jens Axboe Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 On Mon, May 15, 2023 at 7:23=E2=80=AFAM Christian Brauner wrote: > > So I think we will be able to address (1) and (2) by making vhost tasks > proper threads and blocking every signal except for SIGKILL and SIGSTOP > and then having vhost handle get_signal() - as you mentioned - the same > way io uring already does. We should also remove the ingore_signals > thing completely imho. I don't think we ever want to do this with user > workers. Right. That's what IO_URING does: if (args->io_thread) { /* * Mark us an IO worker, and block any signal that isn't * fatal or STOP */ p->flags |=3D PF_IO_WORKER; siginitsetinv(&p->blocked, sigmask(SIGKILL)|sigmask(SIGSTOP= )); } and I really think that vhost should basically do exactly what io_uring doe= s. Not because io_uring fundamentally got this right - but simply because io_uring had almost all the same bugs (and then some), and what the io_uring worker threads ended up doing was to basically zoom in on "this works". And it zoomed in on it largely by just going for "make it look as much as possible as a real user thread", because every time the kernel thread did something different, it just caused problems. So I think the patch should just look something like the attached. Mike, can you test this on whatever vhost test-suite? I did consider getting rid of ".ignore_signals" entirely, and instead just keying the "block signals" behavior off the ".user_worker" flag. But this approach doesn't seem wrong either, and I don't think it's wrong to make the create_io_thread() function say that ".ignore_signals =3D 1" thing explicitly, rather than key it off the ".io_thread" flag. Jens/Christian - comments? Slightly related to this all: I think vhost should also do CLONE_FILES, and get rid of the whole ".no_files" thing. Again, if vhost doesn't use any files, it shouldn't matter, and looking different just to be different is wrong. But if vhost doesn't use any files, the current situation shouldn't be a bug either. Linus