From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CA63C4727E for ; Thu, 24 Sep 2020 21:41:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DA5BC239CF for ; Thu, 24 Sep 2020 21:41:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="V/0YgUUj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DA5BC239CF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7E7956B005D; Thu, 24 Sep 2020 17:41:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 770EB6B0062; Thu, 24 Sep 2020 17:41:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 63AEF6B0068; Thu, 24 Sep 2020 17:41:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0126.hostedemail.com [216.40.44.126]) by kanga.kvack.org (Postfix) with ESMTP id 4B3396B005D for ; Thu, 24 Sep 2020 17:41:48 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 0F50D8249980 for ; Thu, 24 Sep 2020 21:41:48 +0000 (UTC) X-FDA: 77299277496.27.work83_2403d5c27162 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id E6E123D663 for ; Thu, 24 Sep 2020 21:41:47 +0000 (UTC) X-HE-Tag: work83_2403d5c27162 X-Filterd-Recvd-Size: 5675 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Thu, 24 Sep 2020 21:41:47 +0000 (UTC) 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=pHEGyEcLx4wAmD4wOcYy6+1bBrCfu6/M5kZTaPojpLc=; b=V/0YgUUjSutKM6r9bxwG5tb9ogVoqfQx9kIqxlv050A3WtkIwkP25hdHO39JClpSRIjMJk W4I+d3emlleQNteUwDcv5dXLZ+ZIEizU828AoQc0PajblNYEydlMPRW8apMt6jk+IOFAhm 4ZtezxYnq4GeUHKpArLIi1Lr6xH/3OY= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-154-OGlgw1CvOQmOSo9CTnBLHA-1; Thu, 24 Sep 2020 17:41:44 -0400 X-MC-Unique: OGlgw1CvOQmOSo9CTnBLHA-1 Received: by mail-wr1-f69.google.com with SMTP id l15so223530wro.10 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=LpHJ7h0/T9QsAiiRSalG6F3L/ogWipWviz+baUbftUP2TPbAh9Pn9ncvd+acouwZVL 5T9W7Th4lG4Nts9Up2p3UGcbEwzXIt8YMqpzvfVuwRGizYf89rfEatjnul0nZ0PXvta7 eA9PmwPFwylg2uJ6oFV4ndVM0T4nD3O5uempvTO0OVUJZA6sF7Q06R34RNwz4W0Q2Iku yF/Li8kEb6c4QZLrP+YYsWg23NsRVu2jXqxh+t8DOQaiDwD1F7mOxvQYSErHFvXdUErH PL+v6vCZMsR4M0oZsBG/z6Rga6gXk6s1SkrqtFfhltlwa8HLRnxAIskwyz2hBbAHtMq4 JACA== X-Gm-Message-State: AOAM530vkMcD7P9E38h3GpQfso8YbG5rqVoe+eEF4T8awxUAxZsWi4I/ iDtUu0iy6aw45kuD8g2MvCnSm6ySfTCf57kvt+IKMdHGL/07hK7PDvvX1y+mgz843aoX16y9Swm ptVvHsG7t5fk= X-Received: by 2002:adf:ff90:: with SMTP id j16mr1019740wrr.105.1600983703600; Thu, 24 Sep 2020 14:41:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcmOcMLK9ieZTe6UE9SIsXG/tKkkWvHxZX+em+xkUyTPxjCgMj7blLOZyUvF+KwveIZvdq7w== 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) 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) Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: > 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_manag= ed() should fail, detecting a conflicting (busy) resource. Not sure what wi= ll happen next ( and did not double-check). But yeah, the way the BUSY bit is cleared here is wrong - simply overwritin= g other bits. And it would be even better if we could avoid manually messin= g with flags here. >=20