Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2623012pxb; Sun, 17 Oct 2021 20:47:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8Pb8Oq46Ty+YkllAYM8V8XRFdWPPAjx48WadI8Vi4J4RCZ7jjVaMnoJr6zAovrrnKgw5h X-Received: by 2002:a17:902:e801:b0:13f:255:9db5 with SMTP id u1-20020a170902e80100b0013f02559db5mr24635168plg.23.1634528878214; Sun, 17 Oct 2021 20:47:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634528878; cv=none; d=google.com; s=arc-20160816; b=ghI4IqrHLIcDH6FcbZfPyzo/wfgjOJjwVdP71iMVEn0ROU4Q5/i+7+Y5tQvSEwSEN/ GsfVW+G1vN4+6qWcts1HWBgbYX/AbQwKUs7tQxXADukILTIKpgDyBVDnFHBiH9vuTjoQ RbAEGVc/CZHeZNogkffXdbjRXqHyM/d+nranMCZM+qd5perUCSTMIAIXBeSngJnDiXaR n7+LP/VzrKF0IjxXotZFKk8XYyxuYm1+BvLbC1TYXPUimCAKm6KCoiieUZvZ7g8mrHv1 GJAKgMZIDtgcmlKVtMoQgZ0Y/rm6y/9C9nun6sAU+t3MXTrATdJwU2sX9ercCSZdZ+wP Ouqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=4sdPRwUL/VXB1K0GR5jjcD1Cu6k2ChZD/bdO31awtOc=; b=HQTOkDYX9XVemWGzAp9iSbfPC4zXIH7vVSiqoA0/f9Y9ir0jy+h1IQfQC/GDdCrHcB R80Tzoaa2xgqwr6UMyhVvodf4QsxJjo7bTUNu5qyiIFFHIOWMkAiXeg4iE+kozGSKO9X MsmYQ+7q7rRq6pi79BingcVG0RXtWFQPm1tH5ZV0RQCdddd9qQ4rexZiY8ENl61XACWQ NW0CaC4uC+9kIcfDDm1czWoJsB2xMNzxIUnXKIjM+6Fc7nJj51tML4WkDIIubqIqlCVr 470qq+L+gC5NluF79xaSXNfI2cItY1GWimhaNhkJf0bCw1bX6No4c95sH6IMkC8tLHSC apNA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 66si18715617pga.561.2021.10.17.20.47.45; Sun, 17 Oct 2021 20:47:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232361AbhJQSEx (ORCPT + 98 others); Sun, 17 Oct 2021 14:04:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230463AbhJQSEw (ORCPT ); Sun, 17 Oct 2021 14:04:52 -0400 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 128B7C06161C for ; Sun, 17 Oct 2021 11:02:43 -0700 (PDT) Received: from martin by viti.kaiser.cx with local (Exim 4.89) (envelope-from ) id 1mcAUX-0001MQ-QA; Sun, 17 Oct 2021 20:02:37 +0200 Date: Sun, 17 Oct 2021 20:02:37 +0200 From: Martin Kaiser To: "Fabio M. De Francesco" Cc: Phillip Potter , Greg Kroah-Hartman , Larry Finger , Michael Straube , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] staging: r8188eu: don't accept SIGTERM for cmd thread Message-ID: <20211017180237.bvc6spwbj72zyjhi@viti.kaiser.cx> References: <20211016181343.3686-1-martin@kaiser.cx> <2409617.cBYgoVRs56@localhost.localdomain> <1957621.GeRc3qvyWe@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1957621.GeRc3qvyWe@localhost.localdomain> User-Agent: NeoMutt/20170113 (1.7.2) Sender: Martin Kaiser Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Fabio and all, Thus wrote Fabio M. De Francesco (fmdefrancesco@gmail.com): > On Sunday, October 17, 2021 12:29:02 PM CEST Phillip Potter wrote: > > So I myself am a little confused on this one :-) > > Based on my understanding, so correct me if I'm wrong, a process > > (kthread or otherwise) can still be killed if marked TASK_KILLABLE, > > even if ignoring SIGTERM. Indeed, from a userspace perspective, > > SIGKILL is unblockable anyway - although of course kernel code can > > choose how to respond to it. > Correct. And it seems that by default, a kthread can't be killed with SIGKILL. > > So in other words, the kthread could still be killed while waiting > > in the wait_for_completion_killable() call, even if we are ignoring > > SIGTERM. From that perspective I guess, it is therefore not 'incorrect' as > > such - if indeed we wanted that behaviour. > No. This misunderstandings is my fault. :( > In Martin's patch I read "SIGTERM" but for some reason I thought he was > talking of "SIGKILL". > At the moment, without Martin's patch, the kthread can be terminated by the > command "kill -TERM ". If we try "kill -KILL ", nothing happens. > This is because only "allow_signal(SIGTERM);" is present in the code. Exactly. And this is probably not by intention. It would be consistent to either allow both or none - the latter makes more sense, and it's what most other drivers do. > I think that kthreads must also allow SIGKILL with "allow_signal(SIGKILL);" > for allowing root to make them terminate. Probably. nfsd seems to do this. > For what relates to my patch, it doesn't matter if I either leave > wait_for_completion_killable() as-is or change it to wait_for_completion(). > This is because at the moment SIGKILL cannot kill rtw_cmd_thread(), while > SIGTERM can. > However, for consistency, I should better change it to the uninterruptible > version. That makes sense to me. Let's see what Greg and others say... Best regards, Martin