From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jean-Philippe Brucker Subject: Re: [RFCv2 PATCH 09/36] iommu/fault: Allow blocking fault handlers Date: Wed, 29 Nov 2017 15:01:00 +0000 Message-ID: <74891e35-17d8-5831-1ebd-18e00ce00d74@arm.com> References: <20171006133203.22803-1-jean-philippe.brucker@arm.com> <20171006133203.22803-10-jean-philippe.brucker@arm.com> <7e1c8ea4-e568-1000-17de-62f8562c7169@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <7e1c8ea4-e568-1000-17de-62f8562c7169-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> Content-Language: en-US Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Yisheng Xie , "linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" , "linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org" Cc: "joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org" , "robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org" , Mark Rutland , Catalin Marinas , Will Deacon , Lorenzo Pieralisi , "hanjun.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org" , Sudeep Holla , "rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org" , "lenb-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org" , Robin Murphy , "bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org" , "alex.williamson-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org" , "tn-nYOzD4b6Jr9Wk0Htik3J/w@public.gmane.org" , "liubo95-hv44wF8Li93QT0dZR+AlfA@public.gmane.org" , "thunder.leizhen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org" , "gabriele.paoloni-hv44wF8Li93QT0dZR+AlfA@public.gmane.org" , nwatters@cod List-Id: devicetree@vger.kernel.org Hello, On 29/11/17 06:15, Yisheng Xie wrote: > Hi Jean, > > On 2017/10/6 21:31, Jean-Philippe Brucker wrote: >> - if (domain->ext_handler) { >> + if (domain->handler_flags & IOMMU_FAULT_HANDLER_ATOMIC) { >> + fault->flags |= IOMMU_FAULT_ATOMIC; > > Why remove the condition of domain->ext_handler? should it be much better like: > if ((domain->handler_flags & IOMMU_FAULT_HANDLER_ATOMIC) && domain->ext_handler) > > If domain->ext_handler is NULL, and (domain->handler_flags & IOMMU_FAULT_HANDLER_ATOMIC) > is true. It will oops, right? I removed the check because ext_handler shouldn't be NULL if handler_flags has a bit set (as per iommu_set_ext_fault_handler). But you're right that this is fragile, and I overlooked the case where users could call set_ext_fault_handler to clear the fault handler. (Note that this ext_handler will most likely be replaced by the fault infrastructure that Jacob is working on: https://patchwork.kernel.org/patch/10063385/ to which we should add the atomic/blocking flags) Thanks, Jean -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html