Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1560319pxu; Fri, 16 Oct 2020 15:37:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTqWCstQ7/OUFA6FMMO63xxFmIll1O+LwyUgBKq6NjcylKmFJKV94rJEQgs3q4ohzi+4MD X-Received: by 2002:aa7:c68b:: with SMTP id n11mr6346978edq.340.1602887830984; Fri, 16 Oct 2020 15:37:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602887830; cv=none; d=google.com; s=arc-20160816; b=utYV8nzbeE8ty52uBzUMgctup34eTQebHXBjc/ETF5JBMhTtZPv0FGQN1qEtin3BvK 9OMiZOjr1zTr+3uZ/0iKJguT4TamhhXiqO2GXO6rrL9ntiQi9UtIJbnplriaWQ1Pb/ul oYdiflXLf+ZTTuFqHu/cN7h2cTJGhVqsRELuDugozwqw/4Uw5en+w/cAvBNkTh1h/aTQ CT0nHqk/tq53DWgj52R1jEusWEa+pxCVKHMiKWi1l8GyWbhkG5YLobh/IwFeZUIHCWLI pEWXAgPIUZU7bDPvDdKfwjN2oQ0FjDfAtnGN2wGCDaCqeOPEvT+8GN8RAqw6G64LoqHi jv+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=Sw4Y/Wt7tM2dD+n94ti9omNPIQiGoPI87kFrGJopqis=; b=eeMhuHzE0iq5Rox3f9nc7dsEtUn8fEZeynyOBO3cb70YY7v26mJQcEsu9Yla8P8xJx nkJvrhVfPF3uV3BiDlxB0GEv4wUlpon3AbLn8v+Sxf1wnTphGSbbUaiMikfIp7Q5wHvf tRUWfky3XD6fQb15XlNd3L2sSvhM8zRZXcLzlL/nHCSqjKTZwDseGDMyDoVtyT/Pp3mR IcTjKaW29e6Lv4QaRel5PO4SaRjcXyP848cw3tEFLol+AvpUbyCqVn0JpKuT0Ob8XDe1 h6IheXK7YlmtbGDMHoIrTxclUgKBoW0eqvc+4DZQzZVjfpYqnY56cYdtg3G3A8RlxSsw cZ5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=AvnfzyyW; dkim=neutral (no key) header.i=@linutronix.de; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w21si2739068ejj.377.2020.10.16.15.36.49; Fri, 16 Oct 2020 15:37:10 -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; dkim=pass header.i=@linutronix.de header.s=2020 header.b=AvnfzyyW; dkim=neutral (no key) header.i=@linutronix.de; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728786AbgJPVo4 (ORCPT + 99 others); Fri, 16 Oct 2020 17:44:56 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:47032 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728247AbgJPVo4 (ORCPT ); Fri, 16 Oct 2020 17:44:56 -0400 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1602884693; 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=Sw4Y/Wt7tM2dD+n94ti9omNPIQiGoPI87kFrGJopqis=; b=AvnfzyyWAhwaXS8agUNy4fM9ukHCV5Vh4pi/ZXYG4AdsmpNWLP8uaAluacXIgoCA9c7bt+ Ag+jNB7UdMchJ33W7dLoVC1tFUhi2OuuRhgvJXXUGLXYaYbNEtj6VydgUBjdNusn+BdUqo rt3DhQ0o4yhLclLJZPDG6+92+8gCV0i9lIbvAFlQ3YUyEHqHTJiGLvFInqoZvJ9CyTl+0T 3wNaaLLiXybHcvAswwP/8pU1LaZT8EFf7/gPJ8FXX9QnFwSi54wwzaGjddjddqVche0tiJ U2p3rO2HzfomUVsdPPf4NZIrpK1O3HoPlcMMTjmlkb3/lxJzJhXN9egci+suTQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1602884693; 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=Sw4Y/Wt7tM2dD+n94ti9omNPIQiGoPI87kFrGJopqis=; b=CSJc0UzkAtAo29RyuTD/p+Otxpj/XIImHqHBdCxgINsnEN9jVlCQak0k7viWE+usXSc5Ad e4N1/tNIbccZ7zAw== To: Jens Axboe Cc: "linux-kernel\@vger.kernel.org" Subject: Re: [PATCH] task_work: cleanup notification modes In-Reply-To: <93292d5b-9124-d252-c81f-1f2cfbd60e7b@kernel.dk> References: <93292d5b-9124-d252-c81f-1f2cfbd60e7b@kernel.dk> Date: Fri, 16 Oct 2020 23:44:53 +0200 Message-ID: <87tuutalre.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 16 2020 at 09:16, Jens Axboe wrote: > A previous commit changed the notification mode from 0/1 to allowing No. It changed it from boolean to an int. There is a fundamental difference between 0/1 and false/true simply because it's a compiler implementation detail how to represent a boolean value. Assume the following: #define BAZ 0x08 task_work_add(tsk, &work, foo & BAZ); So with a function signature of task_work_add(*tsk, *work, bool signal); the above 'foo & BAZ' becomes either true of false. With the changed function signature of task_work_add(*tsk, *work, int signal); the above becomes the result of 'foo & BAZ' which means that this construct will not longer do the right thing. It's pure luck that none of the usage sites relied on the boolean property of that argument. Please spell it out correctly that converting a boolean argument to an integer argument is not equivalent. > switch (notify) { > + case TWA_NONE: > + break; > case TWA_RESUME: > set_notify_resume(task); > break; The enum will not prevent that either and what you really want to do is to have some form of debug warning if 'notify' is out of range, which would have been the right thing to do in the first place. > - * @notify: send the notification if true > + * @notify: send chosen notification, if any Is that really all you found to be wrong in that comment? There is more and please take your time which will in turn save time and nerves on both ends. Thanks, tglx