Received: by 10.192.165.148 with SMTP id m20csp3698523imm; Mon, 7 May 2018 17:41:14 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqBBH2R4deI2mHL6sOHTzn/rmMcF7agfyoKKfx5VFwhDDduSAw5zwKyH4Lf30443tJMzafD X-Received: by 2002:a17:902:b60a:: with SMTP id b10-v6mr38696875pls.221.1525740074278; Mon, 07 May 2018 17:41:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525740074; cv=none; d=google.com; s=arc-20160816; b=cgWujicuMYRE1LccN91Wtv0Ok6Jo6MTF2DL34j5FCXLLByCDkChaWjUY18Hk8c3LCT 6O3Fptm0xt6KU4N+PGkf3OdlZoQVUdHQk9UouoVw9/hYQhRmfV6t0k0TYslDaMZ6X4TK vYpzoLn8xiT9vNRoNL3nmyQ4Zd9fpRVr3ZBK2+Ou1TASBYf+hnlt1Yred/sEcGoWUTHm Cn47JwaCwSzxiftN6ooYwWXwz1zyECytWmyS+NmKra7iFaIvRy953Ne0TLU1oKSnFZYQ /SyHShkgQf28KXVrBHv1tFQ80S8SS5akCOgmP69HyLvtXrF+yPqnvZpEUWoNh/wlXaeF xaww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:organization:references:in-reply-to:date:cc:to:from :subject:arc-authentication-results; bh=7+ppsqTlTyn0n62mOz/GiPz9bGT/7p/ZiTgl8XJtRrE=; b=N/yzgv6jaWMiN6Sjq04IFASpfZ/9kNQUBw4/bh0uwfb3KbDHPlrUwT5vQHYJfV6/ti N4RFQ05J4qlLQzqGuuDDjz6UswhycvWi35AtZMpvpB2AgMeUnzi43l+96d5E9MF4gyqo 35KQm0PdphDPN/6hfg9bUt4zOJS/2wxMGobZsgWxTEmbBOaQYnW8RawY38sVENUw2ej0 +wUboPVMt3Zh7A6F9JgAHTqQNs+NwqYbRysVuh6HcsC380/q2m6vo/Ff3XAzla9/9xqI bK1xXEGpZtuK+7/hrTWMO2mdg8PQjiMnO4F6WL4wcO+Mw1J833qXDE43K+FYok8Wgtmb lFuQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d9si23808403pfm.226.2018.05.07.17.40.59; Mon, 07 May 2018 17:41:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753765AbeEHAkc (ORCPT + 99 others); Mon, 7 May 2018 20:40:32 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:49416 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751647AbeEHAkb (ORCPT ); Mon, 7 May 2018 20:40:31 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w480cpAc012919 for ; Mon, 7 May 2018 20:40:30 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0b-001b2d01.pphosted.com with ESMTP id 2htwcvhkdb-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 07 May 2018 20:40:30 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 8 May 2018 01:40:28 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 8 May 2018 01:40:24 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w480eN8n62193842 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 8 May 2018 00:40:23 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B7AB65203F; Tue, 8 May 2018 00:30:43 +0100 (BST) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 6620D52049; Tue, 8 May 2018 00:30:43 +0100 (BST) Received: from adsilva.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id B6073A0254; Tue, 8 May 2018 10:40:21 +1000 (AEST) Subject: Re: [PATCH v2 3/7] powerpc: use task_pid_nr() for TID allocation From: "Alastair D'Silva" To: Frederic Barrat , linuxppc-dev@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, mikey@neuling.org, vaibhav@linux.vnet.ibm.com, aneesh.kumar@linux.vnet.ibm.com, malat@debian.org, felix@linux.vnet.ibm.com, pombredanne@nexb.com, sukadev@linux.vnet.ibm.com, npiggin@gmail.com, gregkh@linuxfoundation.org, arnd@arndb.de, andrew.donnellan@au1.ibm.com, fbarrat@linux.vnet.ibm.com, corbet@lwn.net Date: Tue, 08 May 2018 10:40:21 +1000 In-Reply-To: References: <20180417020950.21446-1-alastair@au1.ibm.com> <20180418010810.30937-1-alastair@au1.ibm.com> <20180418010810.30937-4-alastair@au1.ibm.com> Organization: IBM Australia Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.6 (3.26.6-1.fc27) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 18050800-0008-0000-0000-000004F42474 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050800-0009-0000-0000-00001E886232 Message-Id: <1525740021.7796.45.camel@au1.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-05-07_11:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805080004 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2018-05-07 at 19:37 +0200, Frederic Barrat wrote: > > Le 18/04/2018 à 03:08, Alastair D'Silva a écrit : > > From: Alastair D'Silva > > > > The current implementation of TID allocation, using a global IDR, > > may > > result in an errant process starving the system of available TIDs. > > Instead, use task_pid_nr(), as mentioned by the original author. > > The > > scenario described which prevented it's use is not applicable, as > > set_thread_tidr can only be called after the task struct has been > > populated. > > > Here is how I understand what's going to happen if 2 threads are > using > the same TIDR value, which is possible with this patch (if unlikely): > > 1. waking up the wrong thread is not really a problem, as threads > have > to handle spurious wake up from the 'wait' instruction anyway, and > must > be using some other condition to know when to loop around the 'wait' > instruction. > > 2. missing the right thread: if the wrong thread is on a CPU, and a > wake_host_thread/as_notify is sent, the core will see a matching > thread > and will accept the command. The (open)capi adapter won't send an > interrupt. The wrong thread is awaken, which is not a problem as > discussed above. As the right thread to notify is not running, no > harm > is done either: as soon as the thread runs, it's supposed to check > its > condition (which will be met) or call 'wait', but 'wait' immediately > returns when called the first time after a thread is scheduled. > > So I believe we are ok. But I think it requires a huge comment with > the > above (at the minimum) :-) > > With a comment: > Reviewed-by: Frederic Barrat > > Fred > Good point, I'll add this in the next revision. -- Alastair D'Silva Open Source Developer Linux Technology Centre, IBM Australiamob: 0423 762 819