Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp536471ybz; Fri, 1 May 2020 03:56:25 -0700 (PDT) X-Google-Smtp-Source: APiQypKGu0cXP6HV7PqSrDg2I1/DntgCtdlb6iZjH0e4rFf1JW2U+Q+kSvAgDEPdPA7/KNF+WzJh X-Received: by 2002:a17:907:4033:: with SMTP id nk3mr2645380ejb.273.1588330585519; Fri, 01 May 2020 03:56:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588330585; cv=none; d=google.com; s=arc-20160816; b=mUmAg0svvV1bqlKlocPxJlJ1CtjHz9YmuMbOztKMpkoXPENJXpCgyJH81cOymgk3fD juvvVXto7oifoMF2c3yxx3RfyNLCiuPdld1AQe3SJJv23+OAoNNm4A89fNvn+U/kouLk qwrY2/aqaCrioVNKLSJ6t584ol12eMgZrzjQx/RH1pJ4rZk1W/6dUGrd/rsSKKSpNucj xlm6Zv+GGbKFMNbXeJPruJ0uBhRBekmQP8CaFYuUm6b4LyuvFp195FMzh/ilF2MQ9rUW A5J5Kus5JqPGXY7Z68KJgZcZDlYcQg20rntBgw/ZcWQnqrPijdcpYbejPWECXlDgDP+D Y/1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=wvhr/rj9iRPn00vHrREFPhQZA3Sphc9/hCPYqZR5JT8=; b=xGMW6qvJ9QM4JrH4L5pGJaXQ6YYTzkBI/godEmt+z2HZL5Osjg4r5MMnelDHrZ0hgP O537Q505TB/d9OOPodWMEoTBPKF9EmJKERaZmSUMlCCq7VNM0X4RwRvSe+RJMUTbA1f4 K2288MZvQYzNCGivHg/WtJn7Bl4yyH7RQ3zAm3KtBMFhSy0jJgh5m9Cq0yPG6Fo8vvGi VWdHfO0MCJ/qOnuh77MlFy8DxGUZ/XEezJVY9OX2M5RawweDEo6XDyL0Xh6GXGk8orcQ slxCl2gp9EPP2LBe91YncHrLR17MNugJnv02SmXoO9rE6u/IarQ8E8rhrq80WPChUTfL FlVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=n0bXcwbU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v2si1564829edd.536.2020.05.01.03.56.02; Fri, 01 May 2020 03:56:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=n0bXcwbU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728656AbgEAKyL (ORCPT + 99 others); Fri, 1 May 2020 06:54:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:50774 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728485AbgEAKyK (ORCPT ); Fri, 1 May 2020 06:54:10 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 52CBA2076D; Fri, 1 May 2020 10:54:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588330450; bh=0Cqvl5wkP/ieiQF2HFA2QygVgW3pCvJ1D9AWpPCWsIQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=n0bXcwbUgL6TBLTqvsA2xwqNT8DodUpTxzgLWrhXiNgpenfU0AQgCG/72wsVtCmdi Ztk7WzpabT+Gs9SVTrNpDudBKnhy2iHda/QwX5Vm7YVG7vGY7jte5hFaT2LIGSoogi VPoECoDn//owdx1Ia58bFtHwfknjMsoNlDYPebok= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jUTJ2-008Jem-JB; Fri, 01 May 2020 11:54:08 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 01 May 2020 11:54:08 +0100 From: Marc Zyngier To: Mark Rutland , Greg KH Cc: Jeremy Linton , linux-usb@vger.kernel.org, stern@rowland.harvard.edu, git@thegavinli.com, jarkko.sakkinen@linux.intel.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] usb: usbfs: correct kernel->user page attribute mismatch In-Reply-To: <20200501103712.GA51954@C02TD0UTHF1T.local> References: <20200430211922.929165-1-jeremy.linton@arm.com> <20200501070500.GA887524@kroah.com> <20200501103712.GA51954@C02TD0UTHF1T.local> User-Agent: Roundcube Webmail/1.4.3 Message-ID: <0aa2a8a9a5b6c00b2e1a1fcf71c121ce@kernel.org> X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: mark.rutland@arm.com, gregkh@linuxfoundation.org, jeremy.linton@arm.com, linux-usb@vger.kernel.org, stern@rowland.harvard.edu, git@thegavinli.com, jarkko.sakkinen@linux.intel.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-05-01 11:37, Mark Rutland wrote: > On Fri, May 01, 2020 at 09:05:00AM +0200, Greg KH wrote: >> On Thu, Apr 30, 2020 at 04:19:22PM -0500, Jeremy Linton wrote: >> > On arm64, and possibly other architectures, requesting >> > IO coherent memory may return Normal-NC if the underlying >> > hardware isn't coherent. If these pages are then >> > remapped into userspace as Normal, that defeats the >> > purpose of getting Normal-NC, as well as resulting in >> > mappings with differing cache attributes. >> >> What is "Normal-NC"? > > Arm terminology for "Normal Non-Cacheable"; it might be better to say > something like: > > On some architectures (e.g. arm64) an IO coherent mapping may use > non-cachable attributes if the relevant device is cache coherent. is *not* cache coherent. > If userspace mappings are cacheable, these may not be coherent with > non-cacheable mappings. On arm64 this is the case for Normal-NC and > Normal (cacheable) mappings. And to answer some of Greg's questions: - This can show up on current HW that doesn't offer full IO coherency, which is likely on low-end arm/arm64 systems. - I guess nobody noticed this before as x86 is perfectly happy with conflicting attributes for the same physical page, and there is (wild guess) probably not that much userspace making use of shared mappings between kernel and userspace using this interface. Thanks, M. -- Jazz is not dead. It just smells funny...