Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp642173pxk; Thu, 24 Sep 2020 14:46:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIpfzWf4Oia4dfomIMxjq9f2NCMh2EgXuWYF/nJxo4siRNqm7T65k7YaE7pPne/HSzs2l9 X-Received: by 2002:a17:906:e113:: with SMTP id gj19mr647071ejb.263.1600983969262; Thu, 24 Sep 2020 14:46:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600983969; cv=none; d=google.com; s=arc-20160816; b=0+v3FGL2YElVNh3GK4+9wAtRjo4+6rWOmvxR1Z1Kd/W6WkgZinHDWyjAmZvy/mrS0Y +USI6Ggs2vB2DWJqUHR2SAkE2j+6g/6zZG0xdCe08XdDupJIjJFJ6Inu8M5YJ/go9bcI 0Z5gK7uDJTgDKc27jicNCjIOCc3iEs0F5qkZzlHScFjZoQ544HVA2nqvQ2rjSuFaEu/U /eM3ndoAxcqMaFvbl5JH66XZG3zZMzYoBHgoeuAHtqVInDZ2V0UXEQCGURIwSIPArTUp WNIpLe/rOpnZz08n9JLl9BlYToFZviAD3WZlPYkV/Z72Yt23bgSrGZwfKEfawThz4vRN PECg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:in-reply-to:cc:references:message-id:date :subject:mime-version:from:content-transfer-encoding:dkim-signature; bh=g/Xbd+gOY1D7k7S7s+pOd/hTecpIxif1KV3RUcYn5rQ=; b=t9YrOtWmIxW1SlDCCKKTsI/566nbi0eZaFCoLMWonbrhfPR4whgsqsbz1lCQMw+Kgv 46rEdA+UOwhIiXaxOk7uyIFHQzLL7qQV6DKBlw2Ghc22feTNZEOUWQxKWQOYexgsz8Mb o7tlCatMirwNQIVCGsVOLXfvFCcpRLSltIOpDydo/XFLYmIBv6mXrgUBy1wHri/aXaKl to4Aob2/0GFfUWA7AQ7Gxuy/oN6ST+rUobIEdt6lSGGhMLr08ZRC5akdMBvuXDX97cAw Pppc8JGmdqy1Hge3vLuxNpbaGmUE3xf+aRA3Dj/jyMHqs7QMM/QptLQL0XjNDhzPtg/j fceQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IiLvEmPe; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id yj16si620112ejb.592.2020.09.24.14.45.45; Thu, 24 Sep 2020 14:46:09 -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=@redhat.com header.s=mimecast20190719 header.b=IiLvEmPe; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726694AbgIXVls (ORCPT + 99 others); Thu, 24 Sep 2020 17:41:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:36752 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726185AbgIXVls (ORCPT ); Thu, 24 Sep 2020 17:41:48 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600983706; 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; bh=g/Xbd+gOY1D7k7S7s+pOd/hTecpIxif1KV3RUcYn5rQ=; b=IiLvEmPeDTaKbhHWbvgdG6iLxIlAOD039pYflmOr6JsXqMfaEr3011qaFzgTuB71W6RnVs jNNrqHPwhhpwkUM1GpQXRmU0GhTeXmDO3k8Ea0vLipm60xosR9E65W8Cv8cU5XWxts6MLA lMw5C+jdeRZwt87BLgxvxl5FOKsA8R0= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-355-1c2RNAABMqSdZhIDNsMeWQ-1; Thu, 24 Sep 2020 17:41:44 -0400 X-MC-Unique: 1c2RNAABMqSdZhIDNsMeWQ-1 Received: by mail-wm1-f70.google.com with SMTP id r10so261145wmh.0 for ; Thu, 24 Sep 2020 14:41:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=g/Xbd+gOY1D7k7S7s+pOd/hTecpIxif1KV3RUcYn5rQ=; b=jt/JAkQkCQ8Hd00MNgfG+yqAvLBwL3ZKF8zKgFb4UuhzPa+Pe/yck5TaKJKChwL92l wJIEyHU6piGH+OmqHK9x2eDd63fFggJtzkq4T2bnNrOQRA3OAkj1cXIibGp3p5XaMo7i c0MJfyVgt1o7VqqtF41q71FrvKs/l6NqPl3gCzIrobgOPlN6wnwAAPdr+ackAT88EDs4 f1XVwRYnUXcj4vetLMFqe/dz0DvN9abL27SKg1HPMrBXbaJmXHwB3HiP2c8z7PKa6BfT FZ+KBWcqcTvTK1BsGa1yBgKzJFG9ACiLSKim+Bkf2Trn1IYAbU0hFGRY7bs46GjPaQJV IPTg== X-Gm-Message-State: AOAM530kiFn1RqcJ0hGCiRDCjx8nsR2iL7Om4+LPXTKlUPyX3lZoV5ih J/UyJl/VbTcpnp8+eNXB3Gi+35Q70mBcFqryMb/SfWf+Ta49BfthUok+FGhfL/EMJdgnTy7vu83 hQAQKDJWUUan20XnJR14NyYht X-Received: by 2002:adf:ff90:: with SMTP id j16mr1019739wrr.105.1600983703597; Thu, 24 Sep 2020 14:41:43 -0700 (PDT) X-Received: by 2002:adf:ff90:: with SMTP id j16mr1019712wrr.105.1600983703320; Thu, 24 Sep 2020 14:41:43 -0700 (PDT) Received: from localhost.localdomain (p4ff23f51.dip0.t-ipconnect.de. [79.242.63.81]) by smtp.gmail.com with ESMTPSA id e13sm490886wre.60.2020.09.24.14.41.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Sep 2020 14:41:42 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: David Hildenbrand Mime-Version: 1.0 (1.0) Subject: Re: [PATCH v4 11/23] device-dax: Kill dax_kmem_res Date: Thu, 24 Sep 2020 23:41:41 +0200 Message-Id: <79BEC711-C769-432B-9A50-63C6A3AEB0E3@redhat.com> References: Cc: David Hildenbrand , Joao Martins , Andrew Morton , Vishal Verma , Dave Hansen , Pavel Tatashin , Peter Zijlstra , Ard Biesheuvel , Linux MM , linux-nvdimm , Linux Kernel Mailing List , Linux ACPI , Maling list - DRI developers In-Reply-To: To: Dan Williams X-Mailer: iPhone Mail (18A373) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Am 24.09.2020 um 23:26 schrieb Dan Williams : >=20 > =EF=BB=BF[..] >>> I'm not suggesting to busy the whole "virtio" range, just the portion >>> that's about to be passed to add_memory_driver_managed(). >>=20 >> I'm afraid I don't get your point. For virtio-mem: >>=20 >> Before: >>=20 >> 1. Create virtio0 container resource >>=20 >> 2. (somewhen in the future) add_memory_driver_managed() >> - Create resource (System RAM (virtio_mem)), marking it busy/driver >> managed >>=20 >> After: >>=20 >> 1. Create virtio0 container resource >>=20 >> 2. (somewhen in the future) Create resource (System RAM (virtio_mem)), >> marking it busy/driver managed >> 3. add_memory_driver_managed() >>=20 >> Not helpful or simpler IMHO. >=20 > The concern I'm trying to address is the theoretical race window and > layering violation in this sequence in the kmem driver: >=20 > 1/ res =3D request_mem_region(...); > 2/ res->flags =3D IORESOURCE_MEM; > 3/ add_memory_driver_managed(); >=20 > Between 2/ and 3/ something can race and think that it owns the > region. Do I think it will happen in practice, no, but it's still a > pattern that deserves come cleanup. I think in that unlikely event (rather impossible), add_memory_driver_manage= d() should fail, detecting a conflicting (busy) resource. Not sure what will= happen next ( and did not double-check). But yeah, the way the BUSY bit is cleared here is wrong - simply overwriting= other bits. And it would be even better if we could avoid manually messing w= ith flags here. >=20