Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp902323pxb; Tue, 3 Nov 2020 16:07:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJyQm1MyoGGIjDTranZX1Zs1LHkklpXzki9BvFGfnSHVF6Dp3RqAod0eGHzkU0jAivw3lUIB X-Received: by 2002:a17:906:c312:: with SMTP id s18mr17734546ejz.185.1604448450699; Tue, 03 Nov 2020 16:07:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604448450; cv=none; d=google.com; s=arc-20160816; b=HtGgj/42OxjXQKz73FhC2vsBZaQVCP3z6Rbvskndfqi0yPmHrh6lvGFzsHjVmh1MOs EbD3luek2XHvhb+cIzcIDHQp/9BE0VmnsHM4iHwiH8mti5VEGx9ttA1ltwUblieU1/qq i3fnKhfIm07CLeQcfe5CSiDZH1FYI+dw51dn5N/5Vnu+30yqj7YLrmHqQ6eaNLFDLF05 U/o8X2WOwrCF4FEGfdsz5H1FMjEwawHYd0VGN1bSnDlsTpM48SG82aZZJfyh5oaJrPRY GjZ6Osr+ryTI7jRScg28gIouNvooSiuirCgD46in1kw87pXlQoODGnUh7/g63BaEIx7J iGjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Eq/hKMyLgdp/QXXnQV5r6IWOxg03mEPCZUhhSNnW7WQ=; b=TovE2vbwNRwZ6CDjrqnICA+L2jcv6FEgg1PJrldQL5t0W/ElSvOfYEU+4CYrDS5C0b dfpnQbRttr9+883FwkqoZh9sbIXAduRkrcOSg4MXL8NB/mHWzS+Nm0M48OraaiLEuLiN ovZ4cjjwaf3ZLIaemMGuGklK5OCRa/4ECfal9Qmq3qfFqwn29vZ2Kgj23RWhX9xe4Ycm RMHbAemXq12EwUsWWr3dZsH7S3hIwIfn60srJnTDg5QkaLL2sIYZn15c18rkd9sTyQQV LUw0JMKHR3VF1/6CmMB86u8DxdMC3toyQaRK56uIKS3mAj+NPzabXYtSw7dP7AXaJT+k vsHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=kGbCayly; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k5si294955ejk.655.2020.11.03.16.07.06; Tue, 03 Nov 2020 16:07:30 -0800 (PST) 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=@chromium.org header.s=google header.b=kGbCayly; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729779AbgKDAFv (ORCPT + 99 others); Tue, 3 Nov 2020 19:05:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729385AbgKDAFu (ORCPT ); Tue, 3 Nov 2020 19:05:50 -0500 Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEF32C061A48 for ; Tue, 3 Nov 2020 16:05:49 -0800 (PST) Received: by mail-lf1-x141.google.com with SMTP id b1so24645543lfp.11 for ; Tue, 03 Nov 2020 16:05:49 -0800 (PST) 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=Eq/hKMyLgdp/QXXnQV5r6IWOxg03mEPCZUhhSNnW7WQ=; b=kGbCaylyi3k1edOqC9ql7Ui7JoWXWXg6MNLPnsqRDCSqzBsrZ0+FWoh1oZ9OUo8SbC wm654Ccbvp3ZTzDnAtEoYjzR5/5Ho9Nrayfi4QGYwRueZ/YErdfLFzGXCWNWsOJCHpK8 UPppa7VdIAXGPMtTUU1c6bV/Onokcw6tn8Sg0= 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=Eq/hKMyLgdp/QXXnQV5r6IWOxg03mEPCZUhhSNnW7WQ=; b=tTsm4c46Rbc1zOg7X9pbjIXh+1VP9U/HMWDp0dcydK/gq8sP28owTFwBkH7ccV08S5 sw9rMXw5kDHkcjk4Cs67C7FW5pFn06DCUXTE9y2qPh+p/yO6YAE0h5qgP8mdLg1MtF37 USv++zufE2e+HviI7N9FHlipozUr9xZ8wwLAkYsk5NygvpYyYkryIyqNDE2D5cTF2zzc V0TFhw+dFCLaz2h+BM6rdb8/ro0DMZVbLtm/U45e8Wwd/h9otJIMXjd/RNYLGR6UpMC9 tONnW+G5fJOX6CvKmPrA7a1nBTTTGQnWpNl4oWXRGXj0ODggVCET8vt+NiAeWNTMe57S S4Fw== X-Gm-Message-State: AOAM530ipDfVbeLvU/ttc0wMLHUAgX34aCgVtzRPBt9c35aN5wZ6NAOz efP3WADEYWbx/qz3XAOU56g7GLA//WBX5lIn2WQ7HQ== X-Received: by 2002:ac2:44a4:: with SMTP id c4mr9029079lfm.365.1604448348193; Tue, 03 Nov 2020 16:05:48 -0800 (PST) MIME-Version: 1.0 References: <20201103153132.2717326-1-kpsingh@chromium.org> <20201103153132.2717326-8-kpsingh@chromium.org> <20201103184714.iukuqfw2byls3s4k@ast-mbp.dhcp.thefacebook.com> In-Reply-To: From: KP Singh Date: Wed, 4 Nov 2020 01:05:37 +0100 Message-ID: Subject: Re: [PATCH bpf-next v2 7/8] bpf: Add tests for task_local_storage To: Alexei Starovoitov Cc: open list , bpf , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Paul Turner , Jann Horn , Hao Luo Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 3, 2020 at 7:59 PM KP Singh wrote: > > On Tue, Nov 3, 2020 at 7:47 PM Alexei Starovoitov > wrote: > > > > On Tue, Nov 03, 2020 at 04:31:31PM +0100, KP Singh wrote: > > > + > > > +struct storage { > > > + void *inode; > > > + unsigned int value; > > > + /* Lock ensures that spin locked versions of local stoage operations > > > + * also work, most operations in this tests are still single threaded > > > + */ > > > + struct bpf_spin_lock lock; > > > +}; > > > > I think it's a good idea to test spin_lock in local_storage, > > but it seems the test is not doing it fully. > > It's only adding it to the storage, but the program is not accessing it. > > I added it here just to check if the offset calculations (map->spin_lock_off) > are correctly happening for these new maps. > > As mentioned in the updates, I do intend to generalize > tools/testing/selftests/bpf/map_tests/sk_storage_map.c which already has > the threading logic to exercise bpf_spin_lock in storage maps. > Actually, after I added simple bpf_spin_{lock, unlock} to the test programs, I ended up realizing that we have not exposed spin locks to LSM programs for now, this is because they inherit the tracing helpers. I saw the docs mention that these are not exposed to tracing programs due to insufficient preemption checks. Do you think it would be okay to allow them for LSM programs? - KP > Hope this is an okay plan?