Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp76081imu; Mon, 10 Dec 2018 16:29:42 -0800 (PST) X-Google-Smtp-Source: AFSGD/U60TsSHX9UKWpms8yYRd4uygUWuRSpdvrm5iGpJSR8kojo41QWPcxKSUdh4MPmlITAGTi1 X-Received: by 2002:a63:5320:: with SMTP id h32mr12765950pgb.414.1544488182171; Mon, 10 Dec 2018 16:29:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544488182; cv=none; d=google.com; s=arc-20160816; b=ZcegQEY7nf6GQycj+inb2Mo9lI3m/XzaIVxaZyBm10CaK3KjiB2+yFImBC+cYertW/ VH1tdKOPjwpxgvRTmmRjiUXQMRty1mGo1E6Wvo7++eLwiYAdoF0S26687FgHtWPab+y8 jhi6nEMS2pj0OIydFv7JysQ1Ja4syRegU4IU/P/n+FIYTc37r3sGG2VnJ0QGp0LjxeIa hmOyBl/MYzl7TpQC7mOrJPa7SI9+PMkSWnMqijxGjp/b1Su2y9ksVQLkRqj6+RpycM4j BrYRPdxp8u7kXeU2N+o1VmY8RtYsfBqtPDtulrE9v7DkFIcIv6jo4JVn/Sj9Cph30DJ8 hESA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:subject:cc:to:from:date; bh=JMQFFYXj53NLuU41jjQN1360tl3JiKgB3HGJ/T75H7A=; b=XJ4VU8yaMz5jrUrYGrBZtLhOlV0EFitRgHl6GUVEMIDXwVMwwikFjYNIfnzi0HNwgc CD0ca5USUQ5wLBzeYmhXajKAelAUiuwUMaGOHebFarv/zZ78eHiKrEc98wryHVdLGKR/ nti+Cr8QNZVu9mSNoqBp5/1Zh9feM7hhv4h/lbCFqc+RMOAq1/a/DUzCNOiCqXnI3QfZ Vq4nbWBTKLOt8K4eGO2bBq3EwSZ4a6D0tefrQiVnoT5E0R2i3mlNfiJ8mP8hsOMvl44g TAk96goDJP0065Wq5rDrRpikyLu70Jv9ipkc6xoYqqp0xJ/EYZAyXPN1MShPotzBwrUg gTCg== 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 y1si10938649plt.356.2018.12.10.16.29.27; Mon, 10 Dec 2018 16:29:42 -0800 (PST) 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 S1730166AbeLJXdO (ORCPT + 99 others); Mon, 10 Dec 2018 18:33:14 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:33118 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727927AbeLJXdM (ORCPT ); Mon, 10 Dec 2018 18:33:12 -0500 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wBANOM9R089897 for ; Mon, 10 Dec 2018 18:33:11 -0500 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2p9w55kqgj-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 10 Dec 2018 18:33:11 -0500 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 10 Dec 2018 23:33:09 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 10 Dec 2018 23:33:06 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wBANX5Kg57540834 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 10 Dec 2018 23:33:05 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3E4CEA405C; Mon, 10 Dec 2018 23:33:05 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 988BDA4054; Mon, 10 Dec 2018 23:33:04 +0000 (GMT) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 10 Dec 2018 23:33:04 +0000 (GMT) Received: from tungsten.ozlabs.ibm.com (unknown [9.102.46.41]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id BED92A0173; Tue, 11 Dec 2018 10:33:02 +1100 (AEDT) Date: Tue, 11 Dec 2018 10:33:01 +1100 From: Sam Bobroff To: Oliver Cc: Arnd Bergmann , Russell Currey , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , aik@ozlabs.ru, linuxppc-dev , Linux Kernel Mailing List Subject: Re: [PATCH] powerpc: eeh_event: convert semaphore to completion References: <20181210215203.1936171-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Dxnq1zWXvFF0Q93v" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.3 (2018-01-21) X-TM-AS-GCONF: 00 x-cbid: 18121023-0008-0000-0000-0000029F87B5 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18121023-0009-0000-0000-00002209FDEA Message-Id: <20181210233300.GA14707@tungsten.ozlabs.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-12-10_08:,, 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=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812100210 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Dxnq1zWXvFF0Q93v Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Dec 11, 2018 at 10:18:31AM +1100, Oliver wrote: > On Tue, Dec 11, 2018 at 8:52 AM Arnd Bergmann wrote: > > > > For this use case, completions and semaphores are equivalent, > > but semaphores are an awkward interface that should generally > > be avoided, so use the completion instead. >=20 > IIRC Sam has been reworking the locking used inside of EEH so this is > probably going to clash with his changes. Converting to a completion > is probably a good idea, but we might want to do it as a part of his > series since it's going to collide with this anyway. >=20 > Sam, what do you think? It's such a small change, I don't think it will cause any problems for the rework. Anyway it seems like a good change, so I'd prefer to see it go in :-) Cheers, Sam. > > > > Signed-off-by: Arnd Bergmann > > --- > > arch/powerpc/kernel/eeh_event.c | 9 +++------ > > 1 file changed, 3 insertions(+), 6 deletions(-) > > > > diff --git a/arch/powerpc/kernel/eeh_event.c b/arch/powerpc/kernel/eeh_= event.c > > index 61c9356bf9c9..227e57f980df 100644 > > --- a/arch/powerpc/kernel/eeh_event.c > > +++ b/arch/powerpc/kernel/eeh_event.c > > @@ -35,7 +35,7 @@ > > */ > > > > static DEFINE_SPINLOCK(eeh_eventlist_lock); > > -static struct semaphore eeh_eventlist_sem; > > +static DECLARE_COMPLETION(eeh_eventlist_event); > > static LIST_HEAD(eeh_eventlist); > > > > /** > > @@ -55,7 +55,7 @@ static int eeh_event_handler(void * dummy) > > struct eeh_pe *pe; > > > > while (!kthread_should_stop()) { > > - if (down_interruptible(&eeh_eventlist_sem)) > > + if (wait_for_completion_interruptible(&eeh_eventlist_ev= ent)) > > break; > > > > /* Fetch EEH event from the queue */ > > @@ -102,9 +102,6 @@ int eeh_event_init(void) > > struct task_struct *t; > > int ret =3D 0; > > > > - /* Initialize semaphore */ > > - sema_init(&eeh_eventlist_sem, 0); > > - > > t =3D kthread_run(eeh_event_handler, NULL, "eehd"); > > if (IS_ERR(t)) { > > ret =3D PTR_ERR(t); > > @@ -142,7 +139,7 @@ int eeh_send_failure_event(struct eeh_pe *pe) > > spin_unlock_irqrestore(&eeh_eventlist_lock, flags); > > > > /* For EEH deamon to knick in */ > > - up(&eeh_eventlist_sem); > > + complete(&eeh_eventlist_event); > > > > return 0; > > } > > -- > > 2.20.0 > > >=20 --Dxnq1zWXvFF0Q93v Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEELWWF8pdtWK5YQRohMX8w6AQl/iIFAlwO96YACgkQMX8w6AQl /iKCvwf/QsZpJRkrj9J6Kg5f36kvI3ntwmLJbWMt6w/GtQzVcwIizQLRH84mAjNv vQBON2d0gPM8QO1sdaA/Ilu0/LQIFG90NIAZWowX/8Leq0gmwAI9gO1zn15wWOjl NoRboPfBuhi7SzM9XJDf/YXuj7sLCBbKU9Tbj7BDn9cgF+RWxxVsQSHYO2O7LjrW HlPTJBotLzCE+ucI3yc6O0dimjZ4K6uLrNuzPTBSSg9OxY6GqTLF2NR51M+lLdSA YpEBhWLFFiXfr6uGeE+RyIqD50QER4HNW7PPF5pG0RyVRGx4zYvHcRXKV/V5Rx/f xYoJX1OL7THp/VdRBX99OdpcjK9E5Q== =4vZx -----END PGP SIGNATURE----- --Dxnq1zWXvFF0Q93v--