From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934780AbcHEASA (ORCPT ); Thu, 4 Aug 2016 20:18:00 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:35490 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1759373AbcHEAR6 (ORCPT ); Thu, 4 Aug 2016 20:17:58 -0400 X-IBM-Helo: d24dlp01.br.ibm.com X-IBM-MailFrom: mauricfo@linux.vnet.ibm.com X-IBM-RcptTo: linux-doc@vger.kernel.org;linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 0/3] dma-mapping, powerpc, nvme: introduce the DMA_ATTR_NO_WARN attribute To: Andrew Morton References: <1470092390-25451-1-git-send-email-mauricfo@linux.vnet.ibm.com> <20160804150145.fb5690e9a873121db1dfa0b1@linux-foundation.org> Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, corbet@lwn.net, rmk+kernel@arm.linux.org.uk, keith.busch@intel.com, axboe@fb.com, benh@kernel.crashing.org, mpe@ellerman.id.au, k.kozlowski@samsung.com From: Mauricio Faria de Oliveira Date: Thu, 4 Aug 2016 21:17:27 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <20160804150145.fb5690e9a873121db1dfa0b1@linux-foundation.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16080500-0032-0000-0000-00000270DFBA X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16080500-0033-0000-0000-00000EB3CB08 Message-Id: <57A3DB17.3060603@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-08-04_15:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1608050001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Andrew, On 08/04/2016 07:01 PM, Andrew Morton wrote: > It would help to have seen an example of the error message - please > always quote such things when fixing bugs. Indeed; okay. The error messages are several blocks like this one: ppc_iommu_map_sg: 11784 callbacks suppressed nvme 0001:01:00.0: iommu_alloc failed, tbl c00001965c5ca400 vaddr c000018faa7b0000 npages 16 nvme 0001:01:00.0: iommu_alloc failed, tbl c00001965c5ca400 vaddr c000018faa9b0000 npages 16 > I assume the warnings are coming via nvme_map_data()'s call to > blk_rq_map_sg()? [snip] If I understand the point in the question correctly -- actually not, the warnings are coming via: nvme_map_data() -> dma_map_sg[_attrs]() -> dma_map_ops.map_sg() (dma_map_ops = dma_iommu_ops @ arch/powerpc/kernel/iommu.c) -> dma_iommu_map_sg() -> ppc_iommu_map_sg() /* as seen above */ And from what I could observe, the blk_rq_map_sg() path doesn't end up in there. > [snip] An alternative (and more idiomatic) fix would be to > change the blk_rq_map_sg() interface to permit passing down some > foo_NOWARN flag and propagating that down the stack into > ppc_iommu_map_sg(). Was this approach evaluated? I suspect it might > be messy. I see; I haven't evaluated that, but agree with you it might be messy. As far as I can see, in order to pass something to blk_rq_map_sg() and have it eventually make into ppc_iommu_map_sg(), that something should be present in the scatterlist -- which seems to be what's common/passed to both blk_rq_map_sg() (the interface point proposed) and dma_map_sg() (which is the function which reaches ppc_iommu_map_sg() down the chain). It seems a bit hidden, and (if I got the suggestion right), it doesn't seem to be in the scope of scatterlist to contain such a flag. One point of the patches is make the attribute visible/explicit; I see it can be inconvenient sometimes, but it allows for a clear / evident difference between dma_map_sg() calls which are (not) OK with failures. (for example, the 2 calls in nvme_map_data() - they can return either BLK_MQ_RQ_QUEUE_BUSY or BLK_MQ_RQ_QUEUE_ERROR - so the former is OK.) Does that make sense? Thanks for the review. -- Mauricio Faria de Oliveira IBM Linux Technology Center