Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp718891rwr; Thu, 27 Apr 2023 07:20:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4splgSPwVvsvkSsQDkyx2KfnXMfhBd4ThNHdSPMPtDz2PD1p6/tfjJmK0yAV8Fno7t3qQn X-Received: by 2002:a05:6a00:e13:b0:634:c6b9:92e4 with SMTP id bq19-20020a056a000e1300b00634c6b992e4mr2358262pfb.0.1682605236492; Thu, 27 Apr 2023 07:20:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682605236; cv=none; d=google.com; s=arc-20160816; b=vLq+UE71yYTcpt43JQUbuN3iBMKG4UzHsNtjuOp2JuFyQASi1QJwECUIp8iqbwaPug 6oy2ltUir2Y/eY6uv+WTIkEr4+7ZcszEdidcakyErRPXY9XK3giNIUHZlly8Lvwq39y5 DH0TwJUUyld/vlbuxTrhE3rOX6rVJndSNwTgIvMvX937+rLfQqomZrYczka1461IEXrl 1ghr8QqsBGDSboregH5JIK/Ka35u4gqu2y/zT+tdzYipgVsSUr5+GIJvgwRRLveyg/03 HEXrFRBHj4miE67dxQRzLAD66VkJVyLPa2js/sx+1FaSYWpx+T5c+ELhG2SezwIIkM4x 3NKg== 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:content-language:subject:user-agent:mime-version :date:message-id; bh=z8+YDrD1k74MKu1t9pN8hpGEiCgRRouYPy8HwiDmpWU=; b=ALCRuCs5e63LWK1rlOfyxcwTuqEwtpp1ZtqqWqYqLevLd6hjOvGMthfncrE4FChlqV /3foElPuHFIjGHK22uZxzOcn3eCSYRd1MYYvMoOCQdvTKOFBSKMfrdzruQfc3Q7KqjNg gCEcBA0Dq0jWHPK/VG4Tq2vDtgzC0tL1R+6UEgQoU4HALRpLV/KLFB9nCDYC767euAHy gZrya5rbEqPgCc3nM9zCWs31nkasZgkVq+gdw2xzu434WyKbrMlrp58Yt5cMJXKyPsAt SE7Olr5fL+xT8kqfypLgPsZepIT+q2Mfb8FHYm5ONE5Omq1dyQGBI9BwPCTkW47vfXW9 TcSg== 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=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o3-20020a63fb03000000b004faeaac4dacsi19449033pgh.753.2023.04.27.07.20.21; Thu, 27 Apr 2023 07:20:36 -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=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243903AbjD0OQO (ORCPT + 99 others); Thu, 27 Apr 2023 10:16:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243284AbjD0OQJ (ORCPT ); Thu, 27 Apr 2023 10:16:09 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1DB8A49D9 for ; Thu, 27 Apr 2023 07:16:08 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C839F11FB; Thu, 27 Apr 2023 07:16:51 -0700 (PDT) Received: from [10.1.196.177] (eglon.cambridge.arm.com [10.1.196.177]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6949A3F64C; Thu, 27 Apr 2023 07:12:45 -0700 (PDT) Message-ID: <85ae6016-5159-11c7-25e3-9d421195a453@arm.com> Date: Thu, 27 Apr 2023 15:12:21 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Subject: Re: [PATCH v3 10/19] x86/resctrl: Allow resctrl_arch_rmid_read() to sleep Content-Language: en-GB To: Reinette Chatre , x86@kernel.org, linux-kernel@vger.kernel.org Cc: Fenghua Yu , Thomas Gleixner , Ingo Molnar , Borislav Petkov , H Peter Anvin , Babu Moger , shameerali.kolothum.thodi@huawei.com, D Scott Phillips OS , carl@os.amperecomputing.com, lcherian@marvell.com, bobo.shaobowang@huawei.com, tan.shaopeng@fujitsu.com, xingxin.hx@openanolis.org, baolin.wang@linux.alibaba.com, Jamie Iles , Xin Hao , peternewman@google.com References: <20230320172620.18254-1-james.morse@arm.com> <20230320172620.18254-11-james.morse@arm.com> From: James Morse In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,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 Hi Reinette, On 01/04/2023 00:26, Reinette Chatre wrote: > On 3/20/2023 10:26 AM, James Morse wrote: > > ... > >> int resctrl_arch_rmid_read(struct rdt_resource *r, struct rdt_domain *d, >> u32 closid, u32 rmid, enum resctrl_event_id eventid, >> u64 *val) >> { >> struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r); >> struct rdt_hw_domain *hw_dom = resctrl_to_arch_dom(d); >> + struct __rmid_read_arg arg; >> struct arch_mbm_state *am; >> u64 msr_val, chunks; >> - int ret; >> + int err; >> >> - if (!cpumask_test_cpu(smp_processor_id(), &d->cpu_mask)) >> - return -EINVAL; >> + arg.rmid = rmid; >> + arg.eventid = eventid; >> >> - ret = __rmid_read(rmid, eventid, &msr_val); >> - if (ret) >> - return ret; >> + err = smp_call_function_any(&d->cpu_mask, smp_call_rmid_read, &arg, true); >> + if (err) >> + return err; > > This seems to break the assumption of expected return values. __mon_event_count() > does: > rr->err = resctrl_arch_rmid_read() > > and later rdtgroup_mondata_show() only expects -EIO or -EINVAL as errors, with > default of success. Yes, looks like I dithered on whether cpus_read_lock() should be held over this function, or it should tolerate the error. This is protected by rdtgroup_mutex, which means the hotplug callbacks can't run concurrently, so the error can't occur. I'll change it to ignore the return value. Thanks, James