From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (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 B541C223C7D for ; Thu, 19 Dec 2024 11:28:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734607736; cv=none; b=N+yVHsfeQfEif69AMhQWqCzODHc3p6WTlr2CL3bmL08k4DHJGabiMF+TZK90WZg2xID/oC88bvU2eCTnUFIrfECWayqvk8Ur15MHfVtD+U0kijxSi4NFTOoIhZsCar+biP1qt8F9xrY0m4Ueczq2+rg+jwKbLpJKwuB1vw9jAbU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734607736; c=relaxed/simple; bh=wYKv/Dx2yzx4NRTRmlHoRaJNN2B+pKE2rkXs/FSqNo4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=YDZfFRHImeGTs5BL4So5fFbrxZews/M70uh23LEWd+9ofLVROV0lFRY2fB3AYOw5Asn5fV1O49/EsC1yJvHtxBURCzo5+hcFYOO35KAS+Iz80TSW0MQttcgpQPH5I/Ro23awkt2uqJvK8zu7JVCBngMbQMRTFzRGNx3yOBuKBY4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=HC9Cy9nk; arc=none smtp.client-ip=209.85.218.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="HC9Cy9nk" Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-aabfb33aff8so128704866b.0 for ; Thu, 19 Dec 2024 03:28:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1734607731; x=1735212531; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=+efOnqODR5XSbllpBxRT6OF6WIdT5YO+sNBFdgpMN8Y=; b=HC9Cy9nkKAQ+0rhpIJL5R/CA/2cDLyNb4gmJ2lj6LZLiveHb2WztNYzZRTfqb6BInK J4CoPk/Mr6hes3hjbXWgON84eJ/wT/B8kvWHse0DjUcSd73EmZVH7VRDdaWLAaDlAgkj Ktm4wQIx9BaPmTp8+m8Rad8iSbnJH39xGEmrjAx4kwYmrVMSN7PrbJUKLLLNai47P7kK o4ZJ5+y0RJYKtt3EleHa9cmZb8jlj9xIfBqFCOGiA33LuK3TaGCcGVbFY9P/GyBqDc9R /XDJlIvXfvrmVllgYgeDHV3L6KRAIUNwPVhp2z01W4u40UL0WfFUYJnYc8UrgpViJEl7 aDcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734607731; x=1735212531; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=+efOnqODR5XSbllpBxRT6OF6WIdT5YO+sNBFdgpMN8Y=; b=Rmnk70M3V3dUWqbGKlOANZgjt/IJJcuQwsUhJTMO8qqcVFcJRU9BhT3qyBw4htneK9 Z40hPVdYC9QcEDE9b6fwSnAB8Xj23aqrx3xuXUXe5J4xn2TYCP9Oc0lwwqrkBqJ3HxMh hbVKC/IkteqhzxAtqqYeP8ZENcKlWX0n9gkArq4u1b3dR5p8QRfCsVvpBZZthga25mOo jlhfmR5N4GLAfQiQ/S4LX5Zwmfrh/ld/KJvXCAE3XkEcO7dDNyHdLer5QR6/5UCzBh2D 1gY/RoQ8iAi9mZXkZWWFSK2YyMKjn5t58kBH5qZauqFe1uchOzZoGy0t8LB/ndkM7STM PNNA== X-Forwarded-Encrypted: i=1; AJvYcCWZB8jGUFWRJVabUGTK/ekHQGDq4M1XyOUDlQK9xjnTB9ce1mMTlZxI603BUmS06oHyn8DJf2oSWXCvZkU=@vger.kernel.org X-Gm-Message-State: AOJu0YyM/+EN5zFj3IhCzfX0ZEXH5s2XXSsRlkhH1KCwRv5L4LKrMekH 2GT2UY6YpqJG2op10DC8AySOydiyJGDmpRwX+GQgBWIw+GeiVQjsn7qoUOJPlw== X-Gm-Gg: ASbGncvOhaTI2f1L/jmJUIbozGG//RJN0JaJJ/77s65Uxli1zAXkg9tI6AWuH1mDtyk Ec3e4P2wdSpiB9PdEaVRIFlyh6fN1saLS/2nqAIjhfAzoE4XvWmipHDFhFfvRoELJdUEJNn89wj +qCp9wUrMLRsLKc/qUZmxwCZrgy+4ebDGTIXdJ0amwaECvHjpft9jHiuP76ibJ1Y8XcQ/02TJJM SbKXwhAAjG1oLcdmbuV7s+bsbZrMBc5S3An+a7XNYNSnbunrRbY5ufOMUNvTZcBa+B5LIC4X8qY Bg9WnbRiJ0lDSmM= X-Google-Smtp-Source: AGHT+IG3dsXDyN2H9c+ztZK9RDs7OlGyiKmp55kArM+zF0vJy/3UJNS0k2iPLxglWUvLs+MgvKzUiA== X-Received: by 2002:a17:906:308c:b0:aa6:abe7:ff49 with SMTP id a640c23a62f3a-aac08187acdmr234318566b.16.1734607731259; Thu, 19 Dec 2024 03:28:51 -0800 (PST) Received: from google.com (61.134.90.34.bc.googleusercontent.com. [34.90.134.61]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aac0e82f58asm55970766b.39.2024.12.19.03.28.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 03:28:50 -0800 (PST) Date: Thu, 19 Dec 2024 11:28:48 +0000 From: Quentin Perret To: Mostafa Saleh Cc: iommu@lists.linux.dev, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will@kernel.org, maz@kernel.org, oliver.upton@linux.dev, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, robdclark@gmail.com, joro@8bytes.org, robin.murphy@arm.com, jean-philippe@linaro.org, jgg@ziepe.ca, nicolinc@nvidia.com, vdonnefort@google.com, tabba@google.com, danielmentz@google.com, tzukui@google.com Subject: Re: [RFC PATCH v2 11/58] KVM: arm64: pkvm: Add pkvm_udelay() Message-ID: References: <20241212180423.1578358-1-smostafa@google.com> <20241212180423.1578358-12-smostafa@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thursday 19 Dec 2024 at 11:21:40 (+0000), Mostafa Saleh wrote: > On Thu, Dec 19, 2024 at 11:14:23AM +0000, Quentin Perret wrote: > > On Thursday 12 Dec 2024 at 18:03:35 (+0000), Mostafa Saleh wrote: > > > From: Jean-Philippe Brucker > > > > > > Add a simple delay loop for drivers. > > > > > > This could use more work. It should be possible to insert a wfe and save > > > power, but I haven't studied whether it is safe to do so with the host > > > in control of the event stream. The SMMU driver will use wfe anyway for > > > frequent waits (provided the implementation can send command queue > > > events). > > > > Mooh, I'm thoroughly hating that we need this -- pKVM is non preemptible > > so we better not wait for too long. > > > > I can surely figure it out from the following patches, but could you > > please expand on the use-case? > > The driver needs to poll some SMMU MMIO, so it needs to measure time > in terms of udelay to timeout, at the moment its arbitrary set to 100ms. OK, I'll look at the patches to see how hard it'd be to return to the host for scheduling while this is happening. It's probably hard because we're presumably in a funky state, but it's worth trying to figure it out. Any EL2 section longer than 100us or so is problematic in my view, so a 100*ms* timeout is scary!