Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2880754pxb; Tue, 12 Oct 2021 15:41:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3w7OEuFoLOtRNuz2h0DGNAWrAwRnDCHo1aZuX/FlQDeo9J+sgzRWZFAJLGdkaXM1d/8DJ X-Received: by 2002:a05:6402:438f:: with SMTP id o15mr3745260edc.301.1634078515030; Tue, 12 Oct 2021 15:41:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634078515; cv=none; d=google.com; s=arc-20160816; b=k9tE0jRNlJWQTdYUfIwX+PSm/V1qnkHUrJZdBKQP3aAXFazg80YCXEnC74S/p1m1/Z 9rz3tKjKXttvdcTiXGwHeGkOkevEm78iBBtiR73Evau2uqXA9AuHABD79jMErZ2XTt7l wJzur1+y+i0lGcFHryBnsm1rokZUSwSPGwpNzcY/5DfgzjLTvqN6i+yQdhisEwW9/ydW D1sTPIvD/y2cxLvXe4LyoqsXlFxr3b3iuosSuOtUq0Eo3kxo9sFxjwv7MZDOKSbjYtq3 u73a5qoFYI68Jx5dm6Q0vwSPxaDsZtKpkWvRP1QSJZ8/ZoSJDcKAHszm56CTym1nPlYc t+Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=sCeXo3dqmkP0/xhNkOSvbSYV07M3tvRrK4r1EnU84Cw=; b=AuT0aPSYrKwZ4fiWUA4/iUYouBzYSZqCFpgINfpDLxkAHVQNz8KyLuGlMTXgjsIWIZ yBOJV/jGxVX4fYV8DD1zYeeMX+T0nT5a3DjlKVQYdKTKP2pXdDHs79z4byWlk+O5sAdE sjtLmQhk0MqrNVfnmAJMe14jYb1jOscmqUf/3E0TQTyERL8aKGDZAHkwlW4PNj9xxQKr JKkgh1KLFwQwQUT2M6UR+8Sy2ZeyByQGuYJw3FwjudBh2mNnKPMpKAExFFDS9+uoGOMm 27E04djl1fOF+3+tihsM42FCnd1Gw2SaG9xTKx+D0Ex132dpFWsp9o48Qcx6s6HtwuXt scyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=jmWXkZKL; 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=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p7si16176372edw.260.2021.10.12.15.41.31; Tue, 12 Oct 2021 15:41:55 -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=@ibm.com header.s=pp1 header.b=jmWXkZKL; 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=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234012AbhJLWjf (ORCPT + 99 others); Tue, 12 Oct 2021 18:39:35 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:55934 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232419AbhJLWjd (ORCPT ); Tue, 12 Oct 2021 18:39:33 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19CL1cdF010905; Tue, 12 Oct 2021 18:37:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pp1; bh=sCeXo3dqmkP0/xhNkOSvbSYV07M3tvRrK4r1EnU84Cw=; b=jmWXkZKLI5Zql9HD18VOCm80ynoGt/I550/eS1cYqrEZX31AOj8JITnikqhSiCGWQtJV RPPx/50aPIEFqSiX8/nDCY1CFL82FY0glrUkm1l4etCnyUEZ6JMGPygdMOJFBOrIyRiC 5BlXdaJJzEec78RSxld3Q10eWgfLO77KrCVA9nZtAUxB8ismy+675kVJXu3jHzb6OMlX i6sSrVpHUD6LJOmNIeiYwTe3s6fCkurW9xtnmaKXo+2GqCsTC2FwsEZpRE+hntvKdOsZ cME3ICWfELUNNkEE6zZkeWRnl7/XgJ0fwEobtjYY74DiJrvZ2fL6cGa3BwapKWwV0DHU OQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3bnhwv9mbx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Oct 2021 18:37:30 -0400 Received: from m0098416.ppops.net (m0098416.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 19CMbTWD025404; Tue, 12 Oct 2021 18:37:29 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 3bnhwv9mbh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Oct 2021 18:37:29 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 19CMXQSG029155; Tue, 12 Oct 2021 22:37:27 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma03ams.nl.ibm.com with ESMTP id 3bk2q9mv53-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Oct 2021 22:37:27 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 19CMbOpv45810034 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 12 Oct 2021 22:37:24 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0325D52083; Tue, 12 Oct 2021 22:37:24 +0000 (GMT) Received: from li-e979b1cc-23ba-11b2-a85c-dfd230f6cf82 (unknown [9.171.29.112]) by d06av21.portsmouth.uk.ibm.com (Postfix) with SMTP id DF42152082; Tue, 12 Oct 2021 22:37:22 +0000 (GMT) Date: Wed, 13 Oct 2021 00:37:14 +0200 From: Halil Pasic To: Cornelia Huck Cc: Pierre Morel , Vineeth Vijayan , Peter Oberparleiter , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Michael Mueller , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, bfu@redhat.com, Halil Pasic Subject: Re: [RFC PATCH 1/1] s390/cio: make ccw_device_dma_* more robust Message-ID: <20211013003714.1c411f0b.pasic@linux.ibm.com> In-Reply-To: <87pmsawdvr.fsf@redhat.com> References: <20211011115955.2504529-1-pasic@linux.ibm.com> <466de207-e88d-ea93-beec-fbfe10e63a26@linux.ibm.com> <874k9ny6k6.fsf@redhat.com> <20211011204837.7617301b.pasic@linux.ibm.com> <87pmsawdvr.fsf@redhat.com> Organization: IBM X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: FnNmoyxqV9kzXznksfIDmwOd5XzzJui5 X-Proofpoint-GUID: ALJzMp_pvrvA8cXvFjEHX09NUna6vrZG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-12_06,2021-10-12_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 bulkscore=0 lowpriorityscore=0 phishscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 mlxlogscore=718 adultscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110120119 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 12 Oct 2021 15:50:48 +0200 Cornelia Huck wrote: > >> If I read cio_gp_dma_zalloc() correctly, we either get NULL or a valid > >> address, so yes. > >> > > > > I don't think the extra care will hurt us too badly. I prefer to keep > > the IS_ERR_OR_NULL() check because it needs less domain specific > > knowledge to be understood, and because it is more robust. > > It feels weird, though -- I'd rather have a comment that tells me This way the change feels simpler and safer to me. I believe I explained the why above. But if you insist I can change it. I double checked the cio_gp_dma_zalloc() code, and more or less the code called by it. So now I don't feel uncomfortable with the simpler check. On the other hand, I'm not very happy doing changes solely based on somebody's feelings. It would feel much more comfortable with a reason based discussion. One reason to change this to a simple NULL check, is that the IS_ERR_OR_NULL() check could upset the reader of the client code, which only checks for NULL. On the other hand I do believe we have some risk of lumping together different errors here. E.g. dma_pool is NULL or dma ops are not set up properly. Currently we would communicate that kind of a problem as -ENOMEM, which wouldn't be a great match. But since dma_alloc_coherent() returns either NULL or a valid pointer, and furthermore this looks like a common thing in all the mm-api, I decided to be inline with that. TLDR; If you insist, I will change this to a simple null pointer check. > exactly what cio_gp_dma_zalloc() is supposed to return; I would have > expected that a _zalloc function always gives me a valid pointer or > NULL. I don't think we have such a comment for dma_alloc_coherent() or even kmalloc(). I agree, it would be nice to have this behavior documented in the apidoc all over the place. But IMHO that is a different issue. Regards, Halil