Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3353302rdg; Tue, 17 Oct 2023 11:55:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGPajx8Ba/7UFgnnE+9mquEDRa4N6cQbBuE5b+xajCGqWx67Ns3q+baqO4F8zGoLt8XrvyV X-Received: by 2002:a17:90b:3d82:b0:27d:66bd:1c2e with SMTP id pq2-20020a17090b3d8200b0027d66bd1c2emr3017909pjb.7.1697568941348; Tue, 17 Oct 2023 11:55:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697568941; cv=none; d=google.com; s=arc-20160816; b=R8vthQeeLzb+gdrRUPF7y/whRaM5lAYiXN1JDBWRhLT3aC3zxrdR1rAkSIG03HBhoi O63geYd3ptF9Ng/E3v21chSz6wYq6q+48FSXTEgnejCbLh7m9KQJvx9zePWMKMydvgL9 smBrRYuGtIpGSEcsOamb8XjpSOvx3odeu1z6iASkxYInrqdM05D2tX4SQsZjOJJySY9V BzmHBduVk6Sf5r5pC7hipP1Gfrx0+gG4AzsRIcnkcS2jX97PArnaQ2xRG2RzMfsBVQMn AgIxTW947bbF7EaAxA8TSPMlmzNmM+tLuD33rBPXEj/V8MMiu1zI0xno1sAioi09+/yj rV4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=uLnZcT7m+cR+ihtjfCvEhepXOzUUYRn52NrGv1VdUws=; fh=+6E3QeFqBqp+QhlM5P1wR8l/lKv9be8p4pbn2NN4/TY=; b=T8azE8NCHhLbd8vyhfpZkvsdBWTlIANYTJv5c0u4J0+MvynDCERwlOsBhooJ2+cU9S 3F0wOuc4AxXjDKo0VRVHVL2nMyToPtqzuNSDHpkBJFl56uL8hTIT/y7M56cWofvfCWaC 6Nzrbd1IkGOjo/o0NXKZPioHrGUGwyjq9x8DYB7ClvB+F2ZjSy/E1nSRGhXpXLDBQ+55 WnrZxxXdKxEE3znaoGohLkT9GwrannGCLmkGdcjDxXFWJxcClj9F5I9qG5EEAgQb8RB/ iZDktZcaLM5t6shgtUIjlbymVc54QFVOWJv4gp2xBE13vWUruu0+OW/5lAhPZ9dkdF9R A6mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=meIVwqTa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id l7-20020a17090a850700b0027b4d1ee2c6si8931239pjn.144.2023.10.17.11.55.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 11:55:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=meIVwqTa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 102AE801B78D; Tue, 17 Oct 2023 11:55:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344152AbjJQSzM (ORCPT + 99 others); Tue, 17 Oct 2023 14:55:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343885AbjJQSzH (ORCPT ); Tue, 17 Oct 2023 14:55:07 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99C18F5; Tue, 17 Oct 2023 11:55:05 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id F31EA1F8BA; Tue, 17 Oct 2023 18:55:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1697568904; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=uLnZcT7m+cR+ihtjfCvEhepXOzUUYRn52NrGv1VdUws=; b=meIVwqTadDKAQhLi24bvP59mxV0LhjzH3G5WlmQV3YNY1/6YBi1D/D3bFWofMsuMxG9FoB maWj+eH9qeSQNFgUH1+rO4jn9v1r41gRjlmP1YayH2fzln+iUGaCiu3Ojsa1D0SvxcJpli 5I+MMZyv9W3FOYI3kM7hSWGo0Rpj1qA= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A316413584; Tue, 17 Oct 2023 18:55:03 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id qH8QJ4fYLmXGIgAAMHmgww (envelope-from ); Tue, 17 Oct 2023 18:55:03 +0000 Date: Tue, 17 Oct 2023 20:55:02 +0200 From: Michal =?utf-8?Q?Koutn=C3=BD?= To: Haitao Huang Cc: jarkko@kernel.org, dave.hansen@linux.intel.com, tj@kernel.org, linux-kernel@vger.kernel.org, linux-sgx@vger.kernel.org, x86@kernel.org, cgroups@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, sohil.mehta@intel.com, zhiquan1.li@intel.com, kristen@linux.intel.com, seanjc@google.com, zhanb@microsoft.com, anakrish@microsoft.com, mikko.ylinen@linux.intel.com, yangjie@microsoft.com Subject: Re: [PATCH v5 01/18] cgroup/misc: Add per resource callbacks for CSS events Message-ID: References: <20230923030657.16148-1-haitao.huang@linux.intel.com> <20230923030657.16148-2-haitao.huang@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="do7f6ref46fav4tn" Content-Disposition: inline In-Reply-To: <20230923030657.16148-2-haitao.huang@linux.intel.com> Authentication-Results: smtp-out2.suse.de; none X-Spam-Level: X-Spam-Score: -8.66 X-Spamd-Result: default: False [-8.66 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWELVE(0.00)[20]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-2.96)[99.83%] X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 17 Oct 2023 11:55:33 -0700 (PDT) --do7f6ref46fav4tn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 22, 2023 at 08:06:40PM -0700, Haitao Huang wrote: > @@ -276,10 +276,13 @@ static ssize_t misc_cg_max_write(struct kernfs_open= _file *of, char *buf, > =20 > cg =3D css_misc(of_css(of)); > =20 > - if (READ_ONCE(misc_res_capacity[type])) > + if (READ_ONCE(misc_res_capacity[type])) { > WRITE_ONCE(cg->res[type].max, max); > - else > + if (cg->res[type].max_write) > + cg->res[type].max_write(cg); > + } else { > ret =3D -EINVAL; > > + } Is it time for a misc_cg_mutex? This given no synchronization guarantees to implementors of max_write. (Alternatively, document it that the callback must implement own synchronization.) Thanks, Michal --do7f6ref46fav4tn Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQQpEWyjXuwGT2dDBqAGvrMr/1gcjgUCZS7YhAAKCRAGvrMr/1gc jtZGAP9yG0GJSSTgY45EqfHcfkzqyBg2KvAFA7gx5WotIRHTkwD+Mo6bB7HpvmUH 8ZJECbI9T8hXKU0Ff2O/oEC4KwR3Mw8= =5qrs -----END PGP SIGNATURE----- --do7f6ref46fav4tn--