Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp5498252rwb; Wed, 7 Sep 2022 03:58:59 -0700 (PDT) X-Google-Smtp-Source: AA6agR692cbmsJq5X8iFgmlYzTaKq/u41s2w+TezFppojzOcWT6g/4G9U+0ZKPOUSNESDnhSStRT X-Received: by 2002:a17:902:ccc5:b0:172:a995:9b37 with SMTP id z5-20020a170902ccc500b00172a9959b37mr3215076ple.105.1662548339582; Wed, 07 Sep 2022 03:58:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662548339; cv=none; d=google.com; s=arc-20160816; b=t7YDh3hJzaLLFSjkdkofdZp7NV1OzFp74aZpvBQd3lr59o9OpcVkppKdvN6KJTY1p0 IKnHI1mrVSev6vFiRS/hWlUjwVzR2GQTTxhKen3xI1eoMPCXYI30yLdir26NujSHyTNa yMABfRm8Fa8ipGyEtwIKncXCb0f7soLzrrL6KpvtKpjU/7krKHq5Zu3xIcCpFXc8+AcA e8+LOi9t6+ue09M+my9PnjBw5SgADjr8vmrrgroWilrIK0gOO+V59QuGMwMD8bCNIE5o r/UBPA0bH+w5tYv6ff5OXWK+FAWI1Di+PKV7gwLid2hgS+8FzYeDlf0yJFbQKPhl4le+ qAXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=Xiv6mfoVKEEwJnntZJxvPNgD4TtcnmmUZ3MryAsCigk=; b=cNieUal/B5ZIgeLvGu2bDPIoWncrKHK0ozT68FgwHuS/YJEwmfnqghn4hxmj5fFFeD nOeW5ogQm/jnmtxewIRS9MIzLiR3amn452fxV4K8AtmuKii6pJBlQr9djXcbyNXl1epi gbvBf6ssCtoNn0lYcONV+1H0zIc4dh2tsc/ENOhlElvV7NN39Ahl4aVLr2mSklMrFCmJ yYBkKXEPm/leL3W1sPTL/1soHClLS5Oz/ndO3XHIf9WGkfw6e8JfS7hm9uOQzXcyCURH stpiQmPwAYr0CwnSscH9QF4zYtA3FCl5xUGy5jt/tHvqhw+a5JIPLJ5dteWKDM1V4lwk bZ/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t12-20020a170902e1cc00b00176c5805be5si5568145pla.207.2022.09.07.03.58.48; Wed, 07 Sep 2022 03:58:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230075AbiIGJxs (ORCPT + 99 others); Wed, 7 Sep 2022 05:53:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230206AbiIGJxn (ORCPT ); Wed, 7 Sep 2022 05:53:43 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57E5AAEDAE for ; Wed, 7 Sep 2022 02:53:42 -0700 (PDT) Received: from fraeml739-chm.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4MMyCM6myzz687wc; Wed, 7 Sep 2022 17:49:35 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml739-chm.china.huawei.com (10.206.15.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 7 Sep 2022 11:53:39 +0200 Received: from [10.202.227.197] (10.202.227.197) by lhrpeml500003.china.huawei.com (7.191.162.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 7 Sep 2022 10:53:39 +0100 Message-ID: Date: Wed, 7 Sep 2022 10:53:39 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH v2 1/2] iova: Remove some magazine pointer NULL checks To: Ethan Zhao , , , CC: , , References: <1662369083-238529-1-git-send-email-john.garry@huawei.com> <1662369083-238529-2-git-send-email-john.garry@huawei.com> <1d80f56c-bef7-6e5f-0bca-dad35f5e5a8e@linux.intel.com> <3fa23318-6fa7-eba0-30b8-1fb71e6c327e@huawei.com> <7c4383ac-0b0b-dd43-9958-dbd4abeea63f@linux.intel.com> From: John Garry In-Reply-To: <7c4383ac-0b0b-dd43-9958-dbd4abeea63f@linux.intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.202.227.197] X-ClientProxiedBy: lhrpeml500004.china.huawei.com (7.191.163.9) To lhrpeml500003.china.huawei.com (7.191.162.67) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/09/2022 10:33, Ethan Zhao wrote: Hi Ethan, >>> Do you mean iova_magazine_alloc() is impossible to fail ? >> >> No, iova_magazine_alloc() may fail and return NULL. But if it does >> then we set iovad rcache pointer = NULL in the error path and don't >> use the rcache. > > Yup,  if iova_magazine_alloc() failed , > > iovad->rcaches = NULL; > > was set by free_iova_rcaches() > > in error path of iova_domain_init_rcache(). > > and checked in > > alloc_iova_fast()->iova_rcache_get(). > > More comment in code would wipe off my curiosity. As discussed with Robin, we will actually remove that check in iova_rcache_get() for now and in future make the IOVA domain init more robust. As for the "loaded" and "prev" NULL checks removal in this specific patch, I will add more words in the commit message to make it clearer that failure in init was the only way in which they NULL previously. thanks, John