Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1373150rwi; Wed, 19 Oct 2022 09:48:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5BupAWCZ/U5zI59lEQE8lmJUtAHfd+OY3pdpjZ4z/fnkHbv8qZ6En4q2qVGzLxphwVICbQ X-Received: by 2002:a17:907:31ca:b0:780:2170:e08c with SMTP id xf10-20020a17090731ca00b007802170e08cmr7444912ejb.145.1666198094090; Wed, 19 Oct 2022 09:48:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666198094; cv=none; d=google.com; s=arc-20160816; b=RyjZgPIGrOU1mkz1xY4AUnmeo1/OjbYli16HrKqUKUAPFoIQiu62pTk5bBmKu6G6Vt GrnwaAppRN2Bi+89EcgsDKzqCbTYn7ErSNDTPOogzqxzuLeMXEusfYKoOQ8qamT9Qw7o n5oU6rjCb1gRXdUuDDF/AE9QXFFjDJiv9ZtU0Um0mrlI0jKZPaGQfHPF/AlpXnMOB9Ob WnH+/0Qn18Cm4aulny1jblBLNQtawz27+HsaFmE2CDDXzPtWmSzdhgLtoITTNhDjAbZz HCZxzE0iOsVIKTRFTWfe43GYflAMagcKae6QYfMp9+CL79aHd70rmi/+hmFkqF9fDOyj N2pQ== 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=6H1wSHFGixXZH3xTM90S+PR85eEHKCs/O3DG2gkkP2s=; b=PRAJn+JvxHfuAnIBcbFdlFi2PIwlhuYIv8joDNoieAshrsnhgjLpP1tbELktcaBDGd 9WrlnWaOMqcavaKABlkXsc/fRCBOPr89do2nMgLW9NfXLIeMHAdrbHTsCz4qThy0fJb3 dtj2cXhqjN7pP5HaNmccSzKsflZet10spcpFALJqcPWEtofXDjwZAFQZHqMZxuW7tiLl JAyIYuTa5FBPsyGDAkSrylsu/9OPO8Pi8s7InJt4frm1jksgxb7X+tOdIxheDjcfRpgm iMfX6liN5rZafph9G6ZDu7nMCyuJ8BBflGYfK5Duk4PiUDcLCIkKhjUxnt75UveXlyDx Ynuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b="myrTXW/w"; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hd43-20020a17090796ab00b0077f3a9c58e2si18746580ejc.6.2022.10.19.09.47.48; Wed, 19 Oct 2022 09:48:14 -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=@zx2c4.com header.s=20210105 header.b="myrTXW/w"; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231589AbiJSQDr (ORCPT + 99 others); Wed, 19 Oct 2022 12:03:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230160AbiJSQDH (ORCPT ); Wed, 19 Oct 2022 12:03:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E78C415DB00 for ; Wed, 19 Oct 2022 09:02:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B648961920 for ; Wed, 19 Oct 2022 16:02:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6E2CC433D6 for ; Wed, 19 Oct 2022 16:02:07 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="myrTXW/w" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1666195326; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=6H1wSHFGixXZH3xTM90S+PR85eEHKCs/O3DG2gkkP2s=; b=myrTXW/wUhth4KVHcVBn0UJP12pMzbYxFkulRANyp43qbbsAHc9rb0lH9g03WWU3kVystC TB74c+4yMMsHCrGJVPyWYT4chfKwXWV98QuztBJuy7FFg4rQrc3v5gJpahHvIUYK1EbAGJ S8BRuBhQsGGWibc+RvePy/Ta7Manrwk= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 4628ea59 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Wed, 19 Oct 2022 16:02:06 +0000 (UTC) Received: by mail-ua1-f45.google.com with SMTP id f4so7492049uav.3 for ; Wed, 19 Oct 2022 09:02:06 -0700 (PDT) X-Gm-Message-State: ACrzQf0Hr0eyAvMxU/MSU3SMOi9GkgHjhNsIUYRKK9mjDx2QxNidztVJ bHZo/v/cWXszAVrph+umUnX4I7IEdkcP91NAiVM= X-Received: by 2002:ab0:5483:0:b0:3dc:40aa:84cf with SMTP id p3-20020ab05483000000b003dc40aa84cfmr2185549uaa.102.1666195325370; Wed, 19 Oct 2022 09:02:05 -0700 (PDT) MIME-Version: 1.0 References: <0029af41-bf24-9972-10ac-f52e1bdcbf08@linux.intel.com> In-Reply-To: From: "Jason A. Donenfeld" Date: Wed, 19 Oct 2022 10:01:53 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: signal: break out of wait loops on kthread_stop() To: Tvrtko Ursulin Cc: "Eric W. Biederman" , linux-kernel@vger.kernel.org, "Intel-gfx@lists.freedesktop.org" , =?UTF-8?B?VmlsbGUgU3lyasOkbMOk?= Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 Wed, Oct 19, 2022 at 10:00 AM Jason A. Donenfeld wrote: > > On Wed, Oct 19, 2022 at 7:31 AM Tvrtko Ursulin > wrote: > > > > > > Hi, > > > > A question regarding a7c01fa93aeb ("signal: break out of wait loops on > > kthread_stop()") if I may. > > > > We have a bunch code in i915, possibly limited to self tests (ie debug > > builds) but still important for our flows, which spawn kernel threads > > and exercises parts of the driver. > > > > Problem we are hitting with this patch is that code did not really need > > to be signal aware until now. Well to say that more accurately - we were > > able to test the code which is normally executed from userspace, so is > > signal aware, but not worry about -ERESTARTSYS or -EINTR within the test > > cases itself. > > > > For example threads which exercise an internal API for a while until the > > parent calls kthread_stop. Now those tests can hit unexpected errors. > > > > Question is how to best approach working around this change. It is of > > course technically possible to rework our code in more than one way, > > although with some cost and impact already felt due reduced pass rates > > in our automated test suites. > > > > Maybe an opt out kthread flag from this new behavior? Would that be > > acceptable as a quick fix? Or any other comments? > > You can opt out by running `clear_tsk_thread_flag(current, > TIF_NOTIFY_SIGNAL);` at the top of your kthread. But you should really > fix your code instead. Were I your reviewer, I wouldn't merge code > that took the lazy path like that. However, that should work, if you > do opt for the quick fix. Oh my, I haven't had my coffee yet and sent that too fast without thinking straight. That certainly won't work as intended. Sorry for the noise. Jason