Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp20640lqh; Wed, 27 Mar 2024 13:27:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXFkGYAPms4bvGrWDLtTRlgmx6cXvaKW5dm4OUOs+v/lDzM5S7gszW3tDp1QtHuKgPUz2YzBsfq7vIr7NvolH8ac32I9FJkuab5CiaGwg== X-Google-Smtp-Source: AGHT+IGgHOkfY7zhz4KBrTseay4JZj4d3xhB/YcMFQt+c/SwRoW840bXzS8rkRXjLoK/2mMGM2uH X-Received: by 2002:a17:906:3114:b0:a46:70d1:dda6 with SMTP id 20-20020a170906311400b00a4670d1dda6mr348928ejx.28.1711571246173; Wed, 27 Mar 2024 13:27:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711571246; cv=pass; d=google.com; s=arc-20160816; b=OiBEiMtBHLRFG8S9BaxB9peJNxAE21+pQ5c9XGfkQY2hVNZybamxxfIsrAh7v738yo KJH/WpWLJwNMJnoG4nJXbqEvJ9n6x+sLvddUHlQ7wGBAaAcMAUZBWrJBwYARYDDLLIVb 1qwYfvQq5y0pNFuHsRBTua9YVEPaeD6o6esInk5GfbPn7dD6K38+bEl3qaajf2QidvPf h6wvjw9SzM9CU09bue5pt9Fbc7qZvHfW4VJGJDQejNq6+jczLs4Kc6Li7dQLZr+I+1hs koqZORZjydhpBoY8ejynTr7J7HKqjDJhd/evg+sbjRNL//8Ugq7Jl0xK3FB4oOXpbwM9 XNRg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=Qa4G+rafja9Pd/ZwHhTkok07IxAnxqObZh21oazJr/A=; fh=2cCNIxYSUMLj3XdULgV5TmBoLGFN1EQtm0RzRzXn2sA=; b=X1cChtKc3Z8KrNQ0oZcbcQRf3t5WfsSV8lLL4Wh2wN11Jz2wlmpHN6wyB0Jw+0+TCc 7ipMpmNQU7DO+Lfvtf16BnwYiE1/rtX9Szdj2z8WKiZKXRc8/GYA5nyqtHLfnSiFQei0 1zJwfL10dcaWqrCwQyzuUtHRIEs2y/E/PG6/LBY8coj+h07qKWQ8YHQwddQMPtDEPQ0J JWf8F4yN/plfQ1Od5GYlWKjdhi3GcCC6dTUkGmV3Q+VAJ2GhdfXQ9wYi1xZm4PqjoO+1 B8TVQPnEgsOj4vZ3BcVtb16OrbCoVzRP9TlkkPYnQ9+P15CnmrV8PkDc9W6aKSSi+cF6 4XCg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=K6Lgh26O; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-121972-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-121972-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id jz14-20020a170906bb0e00b00a4669ed7188si4797885ejb.1023.2024.03.27.13.27.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 13:27:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-121972-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=K6Lgh26O; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-121972-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-121972-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 am.mirrors.kernel.org (Postfix) with ESMTPS id E04A61F29A99 for ; Wed, 27 Mar 2024 20:27:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7D7BA152508; Wed, 27 Mar 2024 20:27:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="K6Lgh26O" Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (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 622BA14EC63 for ; Wed, 27 Mar 2024 20:27:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711571224; cv=none; b=lxndlFmK/bQ5Al1oVo3kSRJCLpiJKHu8PfWiErXJoi9hB22r4fmmRJtf2lSG09x7A0hpf95UT0tJTAfUTbkS+2jQqbajJAiWQS2G1VYLU3WtKLWhUEFxtfzTFbYkTsgCANOh8k7XWfS2HHWCpd5YE12sZSYN1KJh8d8aWWrMt5I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711571224; c=relaxed/simple; bh=/kMFUecOlLtZ6TruFpDnojpWw0M0AwECSE5Df/hzRSA=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=EUZkysSjAfOO7ajFBzfJ07m1P+1ScZhVUTux2HsbaLA0fpPrtAVxOf0KbfA8iXbmW3C9b4IGLXWKjvYnCsju/1weUMWgm5XvSZlhVht/xOF/8f4e5qgKnmhhiIWo1f5YQz1Idp2ugl2ar7aYYLZuX2FhGyipKjhZnALAmBNiMRM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=K6Lgh26O; arc=none smtp.client-ip=209.85.208.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-2d68cf90ec4so2867761fa.1 for ; Wed, 27 Mar 2024 13:27:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1711571220; x=1712176020; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Qa4G+rafja9Pd/ZwHhTkok07IxAnxqObZh21oazJr/A=; b=K6Lgh26OKsuQMQSKa72FwWGX8iH2c4GTIdqZAr+7tqwBjqpewgO1qmmJIM/hs2+rnT EnxUeukCDBDRucQjz7SdiU8cfkePiB7D9krCnSWY10iQ8oOJQgv4YUl8GkDW2QbkSiHw eWC+RdAru9uyK88ZD7G5HclhlALOqTZEJdryc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711571220; x=1712176020; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Qa4G+rafja9Pd/ZwHhTkok07IxAnxqObZh21oazJr/A=; b=HeSyJFCMxKWR7/E2VSA4HInvlbyv4n8jvc0zJ7VxHGetCjaWTysFR4ab42hkFi8O2k sCLlDOjN9kxND4DI5TsSluJ3gCVeo7eV3+GhzDgNieETOjImUROYNWe81Gv1ZUhk0Vs6 Eweqdna5O3JTveHtYDbJcUXFm2NoAn6lm9IobUidSRvfiZBrCyHfnPGQGmPnFU/Po97p U0dsZiQ0ZbH4xOH4IwfuAZqiRqmPZA6Wb9a1ZDDessH2VYNFd1KtmV1Sm96dRwYJRzuC M+C+ETkuozYR1qNyxxWIDDugETu4lDRsFRxQE+sXwmgN/XaCWLZI9ytsO3abZiqQzoJR Ychw== X-Gm-Message-State: AOJu0YxT+Suk6hmsxnuBl28H13EF4QMw+NWmpKVjwZb/f17qjt7zL5n6 kuEBnRPkmbuvXaqAGzM9b0uhwJ43gOX/v7X92UnPd9RWGzDH8Q68CmLCakDtyvfUtcXebYoGbvT PcjWpaQ== X-Received: by 2002:a05:6512:344b:b0:513:5eea:2942 with SMTP id j11-20020a056512344b00b005135eea2942mr333195lfr.37.1711571220409; Wed, 27 Mar 2024 13:27:00 -0700 (PDT) Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com. [209.85.167.48]) by smtp.gmail.com with ESMTPSA id u16-20020ac248b0000000b00513c7599f73sm1944302lfg.148.2024.03.27.13.26.59 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Mar 2024 13:26:59 -0700 (PDT) Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-512e39226efso143119e87.0 for ; Wed, 27 Mar 2024 13:26:59 -0700 (PDT) X-Received: by 2002:ac2:54b6:0:b0:513:dd66:d5ed with SMTP id w22-20020ac254b6000000b00513dd66d5edmr412518lfk.29.1711571219226; Wed, 27 Mar 2024 13:26:59 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Wed, 27 Mar 2024 13:26:42 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [GIT PULL] Char/Misc driver changes for 6.9-rc1 To: Greg KH , Chris Leech , Nilesh Javali , Christoph Hellwig Cc: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" On Wed, 27 Mar 2024 at 09:56, Linus Torvalds wrote: > > I also *suspect* that using 'physaddr_t' is in itself pointless, > because I *think* the physical addresses are always page-aligned > anyway, and it would be better if the uio_mem thing just contained the > pfn instead. Which could just be 'unsigned long pfn'. Oddly, the uio code seems to be written to allow unaligned page buffers, actual_pages = ((idev->info->mem[mi].addr & ~PAGE_MASK) + idev->info->mem[mi].size + PAGE_SIZE -1) >> PAGE_SHIFT; but none of the mmap routines than actually allow such a mapping, and they all have alignment checks. Which sounds wonderful, until you find code like this duplicated in various uio drivers: uiomem->memtype = UIO_MEM_PHYS; uiomem->addr = r->start & PAGE_MASK; uiomem->offs = r->start & ~PAGE_MASK; uiomem->size = (uiomem->offs + resource_size(r) + PAGE_SIZE - 1) & PAGE_MASK; IOW, it explicitly aligns the resources to pages, so now mmap works again. Oh the horror. But yes, that physical part of 'addr' should be a pfn. Sadly, all of this code is such a mess that it's a horrible job to try to fix it all up. So we may be stuck with the horrendous confusion that is the current uio_mem thing. Linus