From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CA69C77B73 for ; Thu, 27 Apr 2023 14:16:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243911AbjD0OQP (ORCPT ); Thu, 27 Apr 2023 10:16:15 -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 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