Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1802143rdb; Tue, 20 Feb 2024 07:28:03 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUDcXGAtrIxzU1PXw4v5MsFGqK0IqWBEGEZ/c5tTNL+aYbAYF/41bsZChJJ2iX38LELBQwpJWyRZDHDCk8WrUonhpMdz3w4QTF+xCXTug== X-Google-Smtp-Source: AGHT+IGFSh0n1ZmKuG6jE289JDYpiZalwRdifkjCpFJtEKx68gY3Ohp7/TKV+me3t7ny5aNGctR+ X-Received: by 2002:a17:906:1997:b0:a3e:ac2e:65bc with SMTP id g23-20020a170906199700b00a3eac2e65bcmr3729987ejd.62.1708442882847; Tue, 20 Feb 2024 07:28:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708442882; cv=pass; d=google.com; s=arc-20160816; b=aGeQbz0ztpz9rUyXGDh8jyE1ivWU79C6zDhIRBIFXgj95XbUeObPr9o5dxiTp17+pU NSlMaMxZh3NVzbLpfBc0PpwTEIcWZmL7R4T2pgqet+95+vQJuB+a8gsqmzrFDhfdVmH+ zO9YTLNwPWDZ1mK5n5ZXJVP/9kzafTQdHcR+tBG4G4QsgAYCK0spMJ8qCJ+ydWga7ncZ MeO6OwZZ2QnZc4e2JVBwKWhWtyTErctnooHC2Tsi4Cr/MLOJrB28pqF5SBJ5SH/5febC aZEolAx23fCRtoDhHTT9EyOMg2OTqTSgjDENfkuhCa9Ec1Tvo1VOWnKIjQkfG6QdX+FZ y4yA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:autocrypt:from :references:cc:to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=fYOuDIFs/LVlHXgleVMIbbLrukpLufIKk99tU3yPwCc=; fh=WNvZ1MsPaZaL8lkqvBcUDqktpOkRW60uLYX5Icqrwns=; b=X2LlLvQKHF743LQ/2MxmGcpXglHqPek+NA80SuAZWUeB5DUy8WvMqWC/86ki+aw7M2 /MTYrTVjkJ0kYOljgfc7kYor6bYoxhkMvePz9YGdZJ/FZCrDZKhhXVrIunj5tBnrJaFK prGbJWyP2z9L5TFEmrN2zsgfEsCiNtZil2Rk9M2D0SbmYDex9dacfZiv0oKdvYjoA9Fo ucQNBglbIjn7Kif8ETaZ6Dck7Kor6gaDHnzZf4nEt5i8Blo4eDopiqQDRbDTx+AxvaLZ la8jiEOFqis35KD1eZj1/bavE0bvN7ZZPGsKVX0KrGoZI1Q5zpcnR0y3QqaoeO94z050 Jnyw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KtDej+my; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-73238-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73238-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id lx7-20020a170906af0700b00a3ecbdfa4c7si1334707ejb.102.2024.02.20.07.28.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 07:28:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-73238-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KtDej+my; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-73238-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73238-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6CEC71F23E40 for ; Tue, 20 Feb 2024 15:28:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0FD8876037; Tue, 20 Feb 2024 15:27:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="KtDej+my" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F3927602A for ; Tue, 20 Feb 2024 15:27:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708442873; cv=none; b=CCIu+BstjmjedgkeYHx2XZJlJWYNBvzEBhIeeRiLyS5cEhBi18utfj6Xgpb8I+OSEOjgggvGhxKoGWmPD/s9GlpBZNDRIn9BVQjsjLy9zn8SUQJ1AQCju1iwcYtU57GQK83AVVYc7J0fVLb7yHfKXDJPHxDarseaRTwl2W2mnwA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708442873; c=relaxed/simple; bh=mLxWfQLLvOioexeY886N76KCBm89j9DOOaIJB4Zbm3M=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=RVCjaQIzGfF++XudPB2kexlKMteusTzvkfXmHQ9sEs/+xrDk3+uQXQ4Fko+DeOkuVk/fz6y7NHSZq3e19KumKcJqwm9iOeS0Vy1zcB6ect5qZTnhaqsdFAKHq0ijaKeYRNyDc6DYF8c0P6OuLv3biv9OjJktWADnQXsf6HdQe3Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=KtDej+my; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708442870; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=fYOuDIFs/LVlHXgleVMIbbLrukpLufIKk99tU3yPwCc=; b=KtDej+myeKIb7aCYW6BohBHn76cDZwbEVW2vY0RP0gw1tMNd20T3yud/hvJw6jKh4Zo+/c vKIlaeha+D/ZLcADD7ztCtePz/Kg4ZN16BK8w8ZGZh9dOQS2g54q2CpZ+TOuDdgK3zxVL3 yFXriOfGQA9tFpWkHSVJ/3XoTXIln/I= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-677-k030d100OKGaepm9kkR6Gg-1; Tue, 20 Feb 2024 10:27:48 -0500 X-MC-Unique: k030d100OKGaepm9kkR6Gg-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4102b934ba0so30688555e9.2 for ; Tue, 20 Feb 2024 07:27:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708442867; x=1709047667; h=content-transfer-encoding:in-reply-to:organization:autocrypt:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=fYOuDIFs/LVlHXgleVMIbbLrukpLufIKk99tU3yPwCc=; b=d8rY0sPj66D1XUzgWYzn1IjuK5co5DlXyHFBKhptoyD1XVk8BHjwIsJWV7pIe5bWaK VoUXdm8DUAQQLUnCuIyTCzkFGYyGoPPPw5Z4Hx6qn3kz4hXJ1nma19mJ9pihqCE29yuI owyXO1MkDjbrHR9L8C4d8asp2UqMS+ax6nbCveYtI2OJP3qNZ2lRD/XS+NG4O/87T4oi r5c0NeWm9X+cGcHlcJp0QBsQfmJqGVKNBvWoKCMUkHAxGJkVvtRkMvzvU8fbppK5AMWT /qqIvx7iJ8alz2jzQkKI0Mzb7zSKx0LUv7sExcJzQUdRRMciuqbcb5Kv8g6+P5Sc0kak rkAQ== X-Forwarded-Encrypted: i=1; AJvYcCVRZaCoMhiEY5fdvM6u90MTkbs+n585Bf2oUlDaZkuAfjwvq453hamr1TLQYxriDers7unyQUQXt+rA5WLUdsMakp5jGjcLwgx96ClG X-Gm-Message-State: AOJu0YzXX5Qqn6IVmFusqHxMdaj4908rZOEqZ9myD621BGbiy1OTJyWw Tn7NdJfOcDRJVotI2qnKi2cyxJ4ZDuq3EdHjy/5V8Kj9yyR3pbkegBekV2xE1eyQtTw9Nc+XLvn +e/mkngNsaIJjoRt+gicUC0SJhXk7/SrhxT5Z10flCmObtpCSKYGff59ageYMhA== X-Received: by 2002:a05:600c:45c6:b0:412:6dea:443b with SMTP id s6-20020a05600c45c600b004126dea443bmr1820325wmo.7.1708442867525; Tue, 20 Feb 2024 07:27:47 -0800 (PST) X-Received: by 2002:a05:600c:45c6:b0:412:6dea:443b with SMTP id s6-20020a05600c45c600b004126dea443bmr1820297wmo.7.1708442867090; Tue, 20 Feb 2024 07:27:47 -0800 (PST) Received: from ?IPV6:2003:cb:c72a:bc00:9a2d:8a48:ef51:96fb? (p200300cbc72abc009a2d8a48ef5196fb.dip0.t-ipconnect.de. [2003:cb:c72a:bc00:9a2d:8a48:ef51:96fb]) by smtp.gmail.com with ESMTPSA id s8-20020a7bc388000000b00412260889d9sm14901685wmj.1.2024.02.20.07.27.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 20 Feb 2024 07:27:46 -0800 (PST) Message-ID: <52f81c45-efa7-42c7-86f4-fc1084b1d57a@redhat.com> Date: Tue, 20 Feb 2024 16:27:45 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v9 02/24] x86/resctrl: kfree() rmid_ptrs from resctrl_exit() Content-Language: en-US To: James Morse , x86@kernel.org, linux-kernel@vger.kernel.org Cc: Fenghua Yu , Reinette Chatre , 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, baolin.wang@linux.alibaba.com, Jamie Iles , Xin Hao , peternewman@google.com, dfustini@baylibre.com, amitsinght@marvell.com References: <20240213184438.16675-1-james.morse@arm.com> <20240213184438.16675-3-james.morse@arm.com> From: David Hildenbrand Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7An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QAKCRBN3hD3AP+DWrrpD/4qS3dyVRxDcDHIlmguXjC1Q5tZTwNB boaBTPHSy/Nksu0eY7x6HfQJ3xajVH32Ms6t1trDQmPx2iP5+7iDsb7OKAb5eOS8h+BEBDeq 3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6 3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: <20240213184438.16675-3-james.morse@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 13.02.24 19:44, James Morse wrote: > rmid_ptrs[] is allocated from dom_data_init() but never free()d. > > While the exit text ends up in the linker script's DISCARD section, > the direction of travel is for resctrl to be/have loadable modules. > > Add resctrl_put_mon_l3_config() to cleanup any memory allocated > by rdt_get_mon_l3_config(). > > There is no reason to backport this to a stable kernel. > > Signed-off-by: James Morse > Tested-by: Babu Moger > Tested-by: Carl Worth # arm64 > Reviewed-by: Babu Moger > --- [...] > +static void __exit dom_data_exit(void) > +{ > + mutex_lock(&rdtgroup_mutex); > + > + kfree(rmid_ptrs); > + rmid_ptrs = NULL; > + > + mutex_unlock(&rdtgroup_mutex); Just curious: is grabbing that mutex really required? Against which race are we trying to protect ourselves? I suspect this mutex is not required here: if we could racing with someone else, likely freeing that memory would not be safe either. Apart from that LGTM. -- Cheers, David / dhildenb