Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp5751065ybh; Wed, 7 Aug 2019 10:47:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqzx05LIDpo9XdRWR3kq5OZI3YWmgevqFi7ndXZ3fiSkHQqD17Tac7YZRZRiED63+hI17vPy X-Received: by 2002:a17:902:2aab:: with SMTP id j40mr8834846plb.76.1565200034379; Wed, 07 Aug 2019 10:47:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565200034; cv=none; d=google.com; s=arc-20160816; b=jfDxiNt1pNg8Yv8LzFdRJjIwodCOzvB+YW2xE6AKgwuMtzB2Fhx3NL5qlXC7Tfdi/T /qH4WIJoLZmge8/uTUdJLwUfYujrtDSBJkFKFV1L6ssoe89gK6v6Isk9MwNT6bMwTE+h GB3Q/h4s+AKVQdIneN2v52JoCg7FCq0xVE+BJlY+zVKJ+hvhi3HYgDHYev+pggh1o9Qj wI0BiHSPj+FdMDZVI3HoaJ81rJokIbvDaQ5C4xx+yhbD09qlepQlLOXW49Rz9drY86t8 STcYMiPZVlfIBeM0I88XJDSQvlniwEuIvxD9ZpG4L0K0Gr0yi00WNKpuup3UP0a01Erd hpRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=GvSVwyjYkUWZmzb2UwP5yi6JZ1ykYGY6rFaP7/aYTLo=; b=ypmtVyUVnePycZ9NvNC201bL9m7JmLjuiIrDieVOeusmKSl/6aL1H2g6MaJ04ULt1u NZWsAcIomKBUsWc9TuO5ToVD4SFA83xtpKCgOy2UBiyDDNKX9kifEv62BBjpe6DGO9Dz 7VWrIdHxyNXcc1Rgt+lxYOBmR53/C+9RO+T83CCDY2ERf0uWeJoX/0/iq3v1Q9aUCNpW 01pQS3oelfSPCsrOdevIcef2Ee3rO3wk3Sxvnj0KoOUQ0srvzLyzoXeyTUXC0to3ZMvb DDLCDSoHU0A4h5p8wyGmK9b+Vxtg+OcwV0a8VIKFrCIsK0E5ZMpm5uG4ck8XOIXQJM/g mrHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=FffiqU5+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b14si49075871pgi.587.2019.08.07.10.46.59; Wed, 07 Aug 2019 10:47:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=FffiqU5+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389121AbfHGRaQ (ORCPT + 99 others); Wed, 7 Aug 2019 13:30:16 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:40658 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389025AbfHGRaP (ORCPT ); Wed, 7 Aug 2019 13:30:15 -0400 Received: by mail-ot1-f65.google.com with SMTP id l15so50220558oth.7 for ; Wed, 07 Aug 2019 10:30:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GvSVwyjYkUWZmzb2UwP5yi6JZ1ykYGY6rFaP7/aYTLo=; b=FffiqU5+eIuv8kGlzf37a45hctKBFrPl36bD6mU5CnzC9YL5qpM893c3kSRhakuQZQ X4takvwHuxy5NPQWSrC6jaQkzchWaUx1B2uc3JsY5zG+8FLgsHbhVsLvlRlGDAQ4kKoH 5jmnc8EUa0XC26IRhxOfNVAFjlUJkw0FvWnMQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GvSVwyjYkUWZmzb2UwP5yi6JZ1ykYGY6rFaP7/aYTLo=; b=ufmMEPdkhkwlTQqXnOHhB3LpsnNDp42MsZo2UTZwiirB9pWCbmbrdxODhdzTtuFEss NmhXISdIBaD0SkCkacY6OK8UiJZB8mkCVwx/q7XOG9NA6XsulfoRSNu3T0rs4DGqh3l4 CAF8F3lbgvtmuDYd+tuCnrCH2nzeaw3mAn8nEChG+tYBYYEHVzo+H7YTxTFCuQnz2x+h U4gu3pOOpaeYIqpNEsKJiFThLoUWSABYI3D/nuHxZPSfSHjU+nm88GOhS40IP6tc4qoZ xe4D6mZIrfd4PsAjq1T2PfMLGbsn0kWyKDTUn20GUoyeG88T67fsiQ4aUj/4rPNUVIl/ YX1A== X-Gm-Message-State: APjAAAWs9s3TPhWGLENvPVZMIepHyTMBuv5jP3qBNTwflPoZbWzwUoU+ CbkE1QG1oSNr1X5ePWdztHSp45qIFpJyckpDfhnzJw== X-Received: by 2002:a6b:90c1:: with SMTP id s184mr10120928iod.244.1565199015080; Wed, 07 Aug 2019 10:30:15 -0700 (PDT) MIME-Version: 1.0 References: <20190805211451.20176-1-robdclark@gmail.com> <20190806084821.GA17129@lst.de> <20190806143457.GF475@lakrids.cambridge.arm.com> <20190807123807.GD54191@lakrids.cambridge.arm.com> <20190807164958.GA44765@lakrids.cambridge.arm.com> In-Reply-To: <20190807164958.GA44765@lakrids.cambridge.arm.com> From: Rob Clark Date: Wed, 7 Aug 2019 10:30:04 -0700 Message-ID: Subject: Re: [PATCH 1/2] drm: add cache support for arm64 To: Mark Rutland Cc: Christoph Hellwig , Rob Clark , dri-devel , Catalin Marinas , Will Deacon , Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , Allison Randal , Greg Kroah-Hartman , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 7, 2019 at 9:50 AM Mark Rutland wrote: > > On Wed, Aug 07, 2019 at 09:15:54AM -0700, Rob Clark wrote: > > On Wed, Aug 7, 2019 at 5:38 AM Mark Rutland wrote: > > > > > > On Tue, Aug 06, 2019 at 09:31:55AM -0700, Rob Clark wrote: > > > > On Tue, Aug 6, 2019 at 7:35 AM Mark Rutland wrote: > > > > > > > > > > On Tue, Aug 06, 2019 at 07:11:41AM -0700, Rob Clark wrote: > > > > > > On Tue, Aug 6, 2019 at 1:48 AM Christoph Hellwig wrote: > > > > > > > > > > > > > > This goes in the wrong direction. drm_cflush_* are a bad API we need to > > > > > > > get rid of, not add use of it. The reason for that is two-fold: > > > > > > > > > > > > > > a) it doesn't address how cache maintaince actually works in most > > > > > > > platforms. When talking about a cache we three fundamental operations: > > > > > > > > > > > > > > 1) write back - this writes the content of the cache back to the > > > > > > > backing memory > > > > > > > 2) invalidate - this remove the content of the cache > > > > > > > 3) write back + invalidate - do both of the above > > > > > > > > > > > > Agreed that drm_cflush_* isn't a great API. In this particular case > > > > > > (IIUC), I need wb+inv so that there aren't dirty cache lines that drop > > > > > > out to memory later, and so that I don't get a cache hit on > > > > > > uncached/wc mmap'ing. > > > > > > > > > > Is there a cacheable alias lying around (e.g. the linear map), or are > > > > > these addresses only mapped uncached/wc? > > > > > > > > > > If there's a cacheable alias, performing an invalidate isn't sufficient, > > > > > since a CPU can allocate a new (clean) entry at any point in time (e.g. > > > > > as a result of prefetching or arbitrary speculation). > > > > > > > > I *believe* that there are not alias mappings (that I don't control > > > > myself) for pages coming from > > > > shmem_file_setup()/shmem_read_mapping_page().. > > > > > > AFAICT, that's regular anonymous memory, so there will be a cacheable > > > alias in the linear/direct map. > > > > tbh, I'm not 100% sure whether there is a cacheable alias, or whether > > any potential linear map is torn down. > > I'm fairly confident that the linear/direct map cacheable alias is not > torn down when pages are allocated. The gneeric page allocation code > doesn't do so, and I see nothing the shmem code to do so. > > For arm64, we can tear down portions of the linear map, but that has to > be done explicitly, and this is only possible when using rodata_full. If > not using rodata_full, it is not possible to dynamically tear down the > cacheable alias. So, we do end up using GFP_HIGHUSER, which appears to get passed thru when shmem gets to the point of actually allocating pages.. not sure if that just ends up being a hint, or if it guarantees that we don't get something in the linear map. (Bear with me while I "page" this all back in.. last time I dug thru the shmem code was probably pre-armv8, or at least before I had any armv8 hw) BR, -R