Received: by 2002:a05:7208:13ce:b0:7f:395a:35b6 with SMTP id r14csp1204617rbe; Fri, 1 Mar 2024 07:14:57 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWVLeVksbbgEBNYxVE2JWMb1F17nPTktvCFFtoehQQPrhkTre/uZAPGgxXlvL8CNX+PS2RLpCO4cmLpxY/gzAbMZ5YXUc1bvrb7ePM+iA== X-Google-Smtp-Source: AGHT+IHztUTm3YVQMOCJvt5LCCxd9P5eNlTq8guNEygkgXy4JYLam405pUy+aev/0qwCanCugaNb X-Received: by 2002:a17:903:230c:b0:1db:ceb0:2022 with SMTP id d12-20020a170903230c00b001dbceb02022mr2485840plh.27.1709306097191; Fri, 01 Mar 2024 07:14:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709306097; cv=pass; d=google.com; s=arc-20160816; b=hb9rZPVW9kaua6wJOW6b6Y3F7JNRx+qUoc7r+TGwslXQ4cb8gAbDEY3KOqSt5q70vk /AROgdEFqM6qvqkq+NsYjBlEyjzRj8ynW4npcpKzGMcys/N7Cmcz11nCcRTFmMYhU6Dq T2P27rFyoE0wLV1kSLYW5hTXaTzNlXPd2jJoWjSw3xlPZCkc9RvPCw1JPFQYHoCSo296 CDbYuiQxyI66gNJxiWSXBnPRgYbe4JfzWNAPD6JbgtoBh3BSSsZe23WicRB7r5MoQOwQ q+zpE++QvpVDGyxqeUimP3ueEJ5eitc5oIqkJuPzrOumro9dU8zA8pF6DPuQ5Tmb8hD5 CJEA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=04vMMo6bccK56zwp5r5ELDKqpn4WVBvY558bJjYKRPE=; fh=7er0wnETnvDBLjqgoY8Hrpt6uZ+ZuVWhXpw3K8wJ2es=; b=i8mb7rDIJyOawGjXTu3sN4sxnc5Rk+VXi4/fHTdX6Y6Y5bwriwHr6z9KLxLMHmAaCc EI3AM77w6lvLKiUWpH7RIQuCDnxFZOfzO+uAuFM8fMVSDGltW22/aYLQUB4qrxK6jqGJ V+uXdI2Gy2n9un53ccbHsQrYJ9bPcFbV63oPFusPqVsbIcTf4lR0ScQENvWQAknn0/OB KhRwSlyH1cNcZU463g7f7+lshQPP0CVK8MHUIKGPGRqPcUxdj123r6wrsb0cYTj5Yy8Y 7EiWO9wJ70/ml1Q0tVDqTMfsv5EglADolX2Wxaypmh8fDpbHure9CfSE/2VPYNgXtguA iZXA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@toblux-com.20230601.gappssmtp.com header.s=20230601 header.b="eo44/2CT"; arc=pass (i=1 dkim=pass dkdomain=toblux-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-88397-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88397-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id w2-20020a1709027b8200b001dcd2ed9c89si3436453pll.623.2024.03.01.07.14.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 07:14:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88397-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@toblux-com.20230601.gappssmtp.com header.s=20230601 header.b="eo44/2CT"; arc=pass (i=1 dkim=pass dkdomain=toblux-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-88397-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88397-linux.lists.archive=gmail.com@vger.kernel.org" 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id ACC8CB21ED5 for ; Fri, 1 Mar 2024 12:28:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BED516E60E; Fri, 1 Mar 2024 12:28:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toblux-com.20230601.gappssmtp.com header.i=@toblux-com.20230601.gappssmtp.com header.b="eo44/2CT" Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2C0A12AEFF for ; Fri, 1 Mar 2024 12:28:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709296095; cv=none; b=KaZA8yuEyu/MFUlPcNAqADyPM0K9zCyVa38arbgl/SbonxBfiYkHj9HrLbY5O0ucW62Hg2PJjE3KuzTgKUKA++NMTHROESuyxlb3Tvrby2gN5xBvqxVSxWqWWzFOFwbC2uycAHyINg29xd4mDNfscyn/PF1jvFAxvbNtA3t/P10= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709296095; c=relaxed/simple; bh=04vMMo6bccK56zwp5r5ELDKqpn4WVBvY558bJjYKRPE=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=tQi+tIHMyI5GRodxMj8RvQ2vN/nyvKfGHcy6Q6dXXgxRSusJSkudkwEjisMDTKPbDLjX0hl1tEkAQkmHkCtoGFIQnVFXrbKt9K/7Q1G9mc1ayzwrW2zL/6Cmg8Qb9/nFJ/R2HjiwOrjiQHDhNiUvboC2eAf2+sFm/cv+uxkmjXI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toblux.com; spf=none smtp.mailfrom=toblux.com; dkim=pass (2048-bit key) header.d=toblux-com.20230601.gappssmtp.com header.i=@toblux-com.20230601.gappssmtp.com header.b=eo44/2CT; arc=none smtp.client-ip=209.85.218.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toblux.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=toblux.com Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a3f893ad5f4so320905666b.2 for ; Fri, 01 Mar 2024 04:28:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toblux-com.20230601.gappssmtp.com; s=20230601; t=1709296092; x=1709900892; darn=vger.kernel.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=04vMMo6bccK56zwp5r5ELDKqpn4WVBvY558bJjYKRPE=; b=eo44/2CTBgk7D20/GmsUsEDSaGEYi2NC+JlRPM8gmdSu6lbkrXHlxxSUOtDWoOi1/M E/Ajur4lPfs9cok+vNtq33N/SUm79b22BKlTBCcb+xhlElRA+EeJbMQFfbUEnzHiuixS n3lhynJw1BOTtqGY0XKGMB5QE+FeUTHS8ptoKiloev+fs+pPDBjYCCbfvu9a4KExXdue YBHVQIWpxvZj565UnQ13LssmKBHDdusCCNpihk0r0Ua246Oqud1XwcRQZU72hW+Oksd8 lbau3CT4/rro0CINR9hDbkJpyqvlo6f9qxz1kUEx4z08eprtMjGoJ/8DNVdC2I5j69v7 wO2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709296092; x=1709900892; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=04vMMo6bccK56zwp5r5ELDKqpn4WVBvY558bJjYKRPE=; b=OQFCGffSx0rl3wdlTEKaGDp+4XxH735h2n+/EdlDKJeVeOgd0Vvs68A1TYNb60jyOC T1GuC6IVQOAHPTuKohy2Etz4Nfru298s9rM1WDfZ7cA5jqVBHStYv/463e+EjdN6TtzC kFOhLTXrn4W7XXELCEVMv7fUMtteubdO2uwlJt9OsryAycB161Sm0j7dipNOF4JRBKA7 CUM0QJv3OZPirdCTN1YeGB0HRlXBMdrxxKqA2n0V0gaLUKFHE9gr1M8RSgsrP+IUYLjW TGxKMgabJ/wk2+agIvYu5GwLPMCbeEhyDy+6ok+lOx6ts17MhhQWB9YggvHJNwTp+dwv Fjzg== X-Forwarded-Encrypted: i=1; AJvYcCWcWfUorrpwWxW8ikQuEy9ADbSee5bEtUCknV7GVGVqzlHiQ4GGWxjNqmEKT205+9h4TU579Gu3BEG3dBr6tEcCzzEZOpu9MmiVGxAj X-Gm-Message-State: AOJu0Yx9UG7W8Uyp+eVJKbSDBcIcHJVje1TE7Kw7ElCHKLXQax6H0f+f S2ZWJJhQXlpKuja251Ef5qKtTy7c56wEIVHtgatiVwyPkv1lzq2ZsKZAykf+3dY= X-Received: by 2002:a17:906:d92f:b0:a43:af0b:ec31 with SMTP id rn15-20020a170906d92f00b00a43af0bec31mr1242565ejb.53.1709296092465; Fri, 01 Mar 2024 04:28:12 -0800 (PST) Received: from smtpclient.apple ([2001:a61:1069:f701:6c1a:d05d:ad7c:b80d]) by smtp.gmail.com with ESMTPSA id mf24-20020a170906cb9800b00a3e1b4575dfsm1658200ejb.2.2024.03.01.04.28.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Mar 2024 04:28:12 -0800 (PST) Content-Type: text/plain; charset=us-ascii Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.400.31\)) Subject: Re: [PATCH] x86/apic: Use div64_ul() instead of do_div() From: Thorsten Blum In-Reply-To: <7e46123775e64898bd7c467328125ee0@AcuMS.aculab.com> Date: Fri, 1 Mar 2024 13:28:00 +0100 Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "x86@kernel.org" , "H. Peter Anvin" , "Peter Zijlstra (Intel)" , Wei Liu , "linux-kernel@vger.kernel.org" Content-Transfer-Encoding: quoted-printable Message-Id: <8ECEC999-A742-488F-99B2-A076EF9CA2B2@toblux.com> References: <20240227114333.1718-2-thorsten.blum@toblux.com> <7e46123775e64898bd7c467328125ee0@AcuMS.aculab.com> To: David Laight X-Mailer: Apple Mail (2.3774.400.31) > On Feb 29, 2024, at 23:13, David Laight = wrote: >=20 > do_div() does a 64 by 32 divide that gives a 32bit quotient. > div64_ul() does a much more expensive 64 by 64 divide that > can generate a 64bit quotient. Since the dividend and the divisor could (according to the types at = least) both be 64-bit values and do_div() does a 64-by-32 division, the quotient = could potentially be wrong. However, if the values don't require a 64-by-64 division (not even on a = 64-bit system) and the divisor (deltapm) is guaranteed to fit into 32 bits, = wouldn't it make sense to change its type from long to int? Given that acpi_pm_read_early() returns a u32 and is then assigned to = unsigned long pm, this might be the source of the issue. Changing pm and deltapm = from long to u32 and keeping do_div() as is, would improve the types and = remove the Coccinelle warnings...but maybe I'm missing something? Thanks, Thorsten=